@pie-lib/graphing-solution-set 4.0.4-next.3 → 4.0.4-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.
Files changed (310) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/autosize-input.d.ts +10 -0
  3. package/dist/autosize-input.js +66 -0
  4. package/dist/axis/arrow.d.ts +13 -0
  5. package/dist/axis/arrow.js +34 -0
  6. package/dist/axis/axes.d.ts +132 -0
  7. package/dist/axis/axes.js +214 -0
  8. package/dist/axis/index.d.ts +10 -0
  9. package/dist/bg.d.ts +51 -0
  10. package/dist/bg.js +44 -0
  11. package/dist/container/actions.d.ts +15 -0
  12. package/dist/container/actions.js +7 -0
  13. package/dist/container/index.d.ts +58 -0
  14. package/dist/container/index.js +48 -0
  15. package/dist/container/marks.d.ts +10 -0
  16. package/dist/container/marks.js +11 -0
  17. package/dist/container/middleware.d.ts +10 -0
  18. package/dist/container/middleware.js +4 -0
  19. package/dist/container/reducer.d.ts +14 -0
  20. package/dist/container/reducer.js +7 -0
  21. package/dist/coordinates-label.d.ts +50 -0
  22. package/dist/coordinates-label.js +46 -0
  23. package/dist/graph-with-controls.d.ts +85 -0
  24. package/dist/graph-with-controls.js +155 -0
  25. package/dist/graph.d.ts +119 -0
  26. package/dist/graph.js +221 -0
  27. package/dist/grid-setup.d.ts +27 -0
  28. package/dist/grid-setup.js +307 -0
  29. package/dist/grid.d.ts +43 -0
  30. package/dist/grid.js +59 -0
  31. package/dist/index.d.ts +14 -0
  32. package/dist/index.js +6 -0
  33. package/dist/labels.d.ts +73 -0
  34. package/dist/labels.js +134 -0
  35. package/dist/mark-label.d.ts +50 -0
  36. package/dist/mark-label.js +84 -0
  37. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +101 -0
  38. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +63 -0
  39. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +44 -0
  40. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
  41. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
  42. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
  43. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
  44. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
  45. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
  46. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +79 -0
  47. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
  48. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
  49. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
  50. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +50 -0
  51. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
  52. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
  53. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
  54. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
  55. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +47 -0
  56. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +53 -0
  57. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
  58. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
  59. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
  60. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
  61. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
  62. package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +32 -0
  63. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  64. package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
  65. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
  66. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
  67. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
  68. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
  69. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
  70. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
  71. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
  72. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
  73. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
  74. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
  75. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
  76. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
  77. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
  78. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
  79. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
  80. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
  81. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
  82. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
  83. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
  84. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
  85. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
  86. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
  87. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
  88. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
  89. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
  90. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
  91. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
  92. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
  93. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
  94. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
  95. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
  96. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
  97. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
  98. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
  99. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
  100. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
  101. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
  102. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
  103. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
  104. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
  105. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
  106. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
  107. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
  108. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
  109. package/dist/node_modules/.bun/react-redux@9.3.0_9e2203c65d1d5fa1/node_modules/react-redux/dist/react-redux.js +471 -0
  110. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
  111. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
  112. package/dist/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
  113. package/dist/node_modules/.bun/redux@5.0.1/node_modules/redux/dist/redux.js +198 -0
  114. 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
  115. 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
  116. package/dist/node_modules/.bun/use-sync-external-store@1.6.0_f4eacebf2041cd4f/node_modules/use-sync-external-store/with-selector.js +10 -0
  117. package/dist/toggle-bar.d.ts +40 -0
  118. package/dist/tool-menu.d.ts +21 -0
  119. package/dist/tool-menu.js +188 -0
  120. package/dist/tools/index.d.ts +17 -0
  121. package/dist/tools/index.js +12 -0
  122. package/dist/tools/line/component.d.ts +113 -0
  123. package/dist/tools/line/component.js +58 -0
  124. package/dist/tools/line/index.d.ts +13 -0
  125. package/dist/tools/line/index.js +6 -0
  126. package/dist/tools/polygon/component.d.ts +117 -0
  127. package/dist/tools/polygon/component.js +194 -0
  128. package/dist/tools/polygon/index.d.ts +19 -0
  129. package/dist/tools/polygon/index.js +55 -0
  130. package/dist/tools/polygon/line.d.ts +125 -0
  131. package/dist/tools/polygon/polygon.d.ts +122 -0
  132. package/dist/tools/polygon/polygon.js +62 -0
  133. package/dist/tools/shared/arrow-head.d.ts +43 -0
  134. package/dist/tools/shared/arrow-head.js +37 -0
  135. package/dist/tools/shared/line/index.d.ts +240 -0
  136. package/dist/tools/shared/line/index.js +320 -0
  137. package/dist/tools/shared/line/line-path.d.ts +57 -0
  138. package/dist/tools/shared/line/with-root-edge.d.ts +143 -0
  139. package/dist/tools/shared/point/arrow-point.d.ts +57 -0
  140. package/dist/tools/shared/point/arrow-point.js +47 -0
  141. package/dist/tools/shared/point/arrow.d.ts +46 -0
  142. package/dist/tools/shared/point/arrow.js +36 -0
  143. package/dist/tools/shared/point/base-point.d.ts +50 -0
  144. package/dist/tools/shared/point/base-point.js +88 -0
  145. package/dist/tools/shared/point/index.d.ts +217 -0
  146. package/dist/tools/shared/point/index.js +51 -0
  147. package/dist/tools/shared/styles.d.ts +24 -0
  148. package/dist/tools/shared/styles.js +17 -0
  149. package/dist/tools/shared/types.d.ts +15 -0
  150. package/dist/tools/shared/types.js +10 -0
  151. package/dist/undo-redo.d.ts +20 -0
  152. package/dist/undo-redo.js +33 -0
  153. package/dist/use-debounce.d.ts +9 -0
  154. package/dist/use-debounce.js +13 -0
  155. package/dist/utils.d.ts +58 -0
  156. package/dist/utils.js +72 -0
  157. package/package.json +46 -34
  158. package/CHANGELOG.json +0 -1
  159. package/CHANGELOG.md +0 -449
  160. package/LICENSE.md +0 -5
  161. package/lib/axis/arrow.js +0 -79
  162. package/lib/axis/arrow.js.map +0 -1
  163. package/lib/axis/axes.js +0 -327
  164. package/lib/axis/axes.js.map +0 -1
  165. package/lib/axis/index.js +0 -21
  166. package/lib/axis/index.js.map +0 -1
  167. package/lib/bg.js +0 -114
  168. package/lib/bg.js.map +0 -1
  169. package/lib/container/actions.js +0 -18
  170. package/lib/container/actions.js.map +0 -1
  171. package/lib/container/index.js +0 -120
  172. package/lib/container/index.js.map +0 -1
  173. package/lib/container/marks.js +0 -22
  174. package/lib/container/marks.js.map +0 -1
  175. package/lib/container/middleware.js +0 -19
  176. package/lib/container/middleware.js.map +0 -1
  177. package/lib/container/reducer.js +0 -18
  178. package/lib/container/reducer.js.map +0 -1
  179. package/lib/coordinates-label.js +0 -77
  180. package/lib/coordinates-label.js.map +0 -1
  181. package/lib/graph-with-controls.js +0 -297
  182. package/lib/graph-with-controls.js.map +0 -1
  183. package/lib/graph.js +0 -353
  184. package/lib/graph.js.map +0 -1
  185. package/lib/grid-setup.js +0 -414
  186. package/lib/grid-setup.js.map +0 -1
  187. package/lib/grid.js +0 -131
  188. package/lib/grid.js.map +0 -1
  189. package/lib/index.js +0 -40
  190. package/lib/index.js.map +0 -1
  191. package/lib/labels.js +0 -199
  192. package/lib/labels.js.map +0 -1
  193. package/lib/mark-label.js +0 -159
  194. package/lib/mark-label.js.map +0 -1
  195. package/lib/toggle-bar.js +0 -248
  196. package/lib/toggle-bar.js.map +0 -1
  197. package/lib/tool-menu.js +0 -218
  198. package/lib/tool-menu.js.map +0 -1
  199. package/lib/tools/index.js +0 -24
  200. package/lib/tools/index.js.map +0 -1
  201. package/lib/tools/line/component.js +0 -92
  202. package/lib/tools/line/component.js.map +0 -1
  203. package/lib/tools/line/index.js +0 -11
  204. package/lib/tools/line/index.js.map +0 -1
  205. package/lib/tools/polygon/component.js +0 -358
  206. package/lib/tools/polygon/component.js.map +0 -1
  207. package/lib/tools/polygon/index.js +0 -89
  208. package/lib/tools/polygon/index.js.map +0 -1
  209. package/lib/tools/polygon/line.js +0 -114
  210. package/lib/tools/polygon/line.js.map +0 -1
  211. package/lib/tools/polygon/polygon.js +0 -128
  212. package/lib/tools/polygon/polygon.js.map +0 -1
  213. package/lib/tools/shared/arrow-head.js +0 -62
  214. package/lib/tools/shared/arrow-head.js.map +0 -1
  215. package/lib/tools/shared/line/index.js +0 -539
  216. package/lib/tools/shared/line/index.js.map +0 -1
  217. package/lib/tools/shared/line/line-path.js +0 -121
  218. package/lib/tools/shared/line/line-path.js.map +0 -1
  219. package/lib/tools/shared/line/with-root-edge.js +0 -121
  220. package/lib/tools/shared/line/with-root-edge.js.map +0 -1
  221. package/lib/tools/shared/point/arrow-point.js +0 -86
  222. package/lib/tools/shared/point/arrow-point.js.map +0 -1
  223. package/lib/tools/shared/point/arrow.js +0 -70
  224. package/lib/tools/shared/point/arrow.js.map +0 -1
  225. package/lib/tools/shared/point/base-point.js +0 -137
  226. package/lib/tools/shared/point/base-point.js.map +0 -1
  227. package/lib/tools/shared/point/index.js +0 -80
  228. package/lib/tools/shared/point/index.js.map +0 -1
  229. package/lib/tools/shared/styles.js +0 -26
  230. package/lib/tools/shared/styles.js.map +0 -1
  231. package/lib/tools/shared/types.js +0 -15
  232. package/lib/tools/shared/types.js.map +0 -1
  233. package/lib/undo-redo.js +0 -67
  234. package/lib/undo-redo.js.map +0 -1
  235. package/lib/use-debounce.js +0 -25
  236. package/lib/use-debounce.js.map +0 -1
  237. package/lib/utils.js +0 -235
  238. package/lib/utils.js.map +0 -1
  239. package/src/__tests__/bg.test.jsx +0 -250
  240. package/src/__tests__/coordinates-label.test.jsx +0 -243
  241. package/src/__tests__/graph-with-controls.test.jsx +0 -184
  242. package/src/__tests__/graph.test.jsx +0 -93
  243. package/src/__tests__/grid-setup.test.jsx +0 -645
  244. package/src/__tests__/grid.test.jsx +0 -23
  245. package/src/__tests__/labels.test.jsx +0 -41
  246. package/src/__tests__/mark-label.test.jsx +0 -66
  247. package/src/__tests__/toggle-bar.test.jsx +0 -106
  248. package/src/__tests__/tool-menu.test.jsx +0 -453
  249. package/src/__tests__/undo-redo.test.jsx +0 -26
  250. package/src/__tests__/use-debounce.test.js +0 -21
  251. package/src/__tests__/utils.js +0 -41
  252. package/src/__tests__/utils.test.js +0 -105
  253. package/src/axis/__tests__/arrow.test.jsx +0 -43
  254. package/src/axis/__tests__/axes.test.jsx +0 -182
  255. package/src/axis/arrow.jsx +0 -57
  256. package/src/axis/axes.jsx +0 -284
  257. package/src/axis/index.js +0 -3
  258. package/src/bg.jsx +0 -96
  259. package/src/container/__tests__/actions.test.js +0 -105
  260. package/src/container/__tests__/index.test.jsx +0 -227
  261. package/src/container/__tests__/marks.test.js +0 -172
  262. package/src/container/__tests__/middleware.test.js +0 -235
  263. package/src/container/__tests__/reducer.test.js +0 -324
  264. package/src/container/actions.js +0 -8
  265. package/src/container/index.jsx +0 -85
  266. package/src/container/marks.js +0 -14
  267. package/src/container/middleware.js +0 -7
  268. package/src/container/reducer.js +0 -5
  269. package/src/coordinates-label.jsx +0 -62
  270. package/src/graph-with-controls.jsx +0 -242
  271. package/src/graph.jsx +0 -333
  272. package/src/grid-setup.jsx +0 -432
  273. package/src/grid.jsx +0 -133
  274. package/src/index.js +0 -7
  275. package/src/labels.jsx +0 -173
  276. package/src/mark-label.jsx +0 -125
  277. package/src/toggle-bar.jsx +0 -221
  278. package/src/tool-menu.jsx +0 -235
  279. package/src/tools/index.js +0 -8
  280. package/src/tools/line/__tests__/component.test.jsx +0 -37
  281. package/src/tools/line/component.jsx +0 -77
  282. package/src/tools/line/index.js +0 -4
  283. package/src/tools/polygon/__tests__/component.test.jsx +0 -487
  284. package/src/tools/polygon/__tests__/index.test.js +0 -65
  285. package/src/tools/polygon/__tests__/line.test.jsx +0 -23
  286. package/src/tools/polygon/__tests__/polygon.test.jsx +0 -44
  287. package/src/tools/polygon/component.jsx +0 -324
  288. package/src/tools/polygon/index.js +0 -52
  289. package/src/tools/polygon/line.jsx +0 -80
  290. package/src/tools/polygon/polygon.jsx +0 -93
  291. package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -33
  292. package/src/tools/shared/arrow-head.jsx +0 -46
  293. package/src/tools/shared/line/__tests__/index.test.jsx +0 -553
  294. package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -56
  295. package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -488
  296. package/src/tools/shared/line/index.jsx +0 -471
  297. package/src/tools/shared/line/line-path.jsx +0 -85
  298. package/src/tools/shared/line/with-root-edge.jsx +0 -97
  299. package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
  300. package/src/tools/shared/point/__tests__/arrow.test.jsx +0 -469
  301. package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
  302. package/src/tools/shared/point/arrow-point.jsx +0 -60
  303. package/src/tools/shared/point/arrow.jsx +0 -40
  304. package/src/tools/shared/point/base-point.jsx +0 -113
  305. package/src/tools/shared/point/index.jsx +0 -58
  306. package/src/tools/shared/styles.js +0 -20
  307. package/src/tools/shared/types.js +0 -8
  308. package/src/undo-redo.jsx +0 -37
  309. package/src/use-debounce.js +0 -13
  310. package/src/utils.js +0 -230
@@ -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 "@pie-element/shared-lodash";
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,19 @@
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
+ };
@@ -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,125 @@
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(): React.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(): React.JSX.Element;
70
+ context: unknown;
71
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
72
+ forceUpdate(callback?: (() => void) | undefined): void;
73
+ readonly props: Readonly<{}>;
74
+ state: Readonly<{}>;
75
+ refs: {
76
+ [key: string]: React.ReactInstance;
77
+ };
78
+ componentDidMount?(): void;
79
+ shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
80
+ componentWillUnmount?(): void;
81
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
82
+ getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
83
+ componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
84
+ componentWillMount?(): void;
85
+ UNSAFE_componentWillMount?(): void;
86
+ componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
87
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
88
+ componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
89
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
90
+ };
91
+ propTypes: {
92
+ disabled: PropTypes.Requireable<boolean>;
93
+ onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
94
+ onDrag: PropTypes.Requireable<(...args: any[]) => any>;
95
+ onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
96
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
97
+ onMove: PropTypes.Requireable<(...args: any[]) => any>;
98
+ graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
99
+ scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
100
+ x: PropTypes.Validator<(...args: any[]) => any>;
101
+ y: PropTypes.Validator<(...args: any[]) => any>;
102
+ }>>>;
103
+ snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
104
+ x: PropTypes.Validator<(...args: any[]) => any>;
105
+ y: PropTypes.Validator<(...args: any[]) => any>;
106
+ }>>>;
107
+ domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
108
+ min: PropTypes.Validator<number>;
109
+ max: PropTypes.Validator<number>;
110
+ step: PropTypes.Requireable<number>;
111
+ }>>>;
112
+ range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
113
+ min: PropTypes.Validator<number>;
114
+ max: PropTypes.Validator<number>;
115
+ step: PropTypes.Requireable<number>;
116
+ }>>>;
117
+ size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
118
+ width: PropTypes.Validator<number>;
119
+ height: PropTypes.Validator<number>;
120
+ }>>>;
121
+ }>>>;
122
+ };
123
+ contextType?: React.Context<any> | undefined;
124
+ };
125
+ export default _default;
@@ -0,0 +1,122 @@
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(): React.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(): React.JSX.Element;
67
+ context: unknown;
68
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
69
+ forceUpdate(callback?: (() => void) | undefined): void;
70
+ readonly props: Readonly<{}>;
71
+ state: Readonly<{}>;
72
+ refs: {
73
+ [key: string]: React.ReactInstance;
74
+ };
75
+ componentDidMount?(): void;
76
+ shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
77
+ componentWillUnmount?(): void;
78
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
79
+ getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
80
+ componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
81
+ componentWillMount?(): void;
82
+ UNSAFE_componentWillMount?(): void;
83
+ componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
84
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
85
+ componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
86
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
87
+ };
88
+ propTypes: {
89
+ disabled: PropTypes.Requireable<boolean>;
90
+ onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
91
+ onDrag: PropTypes.Requireable<(...args: any[]) => any>;
92
+ onDragStop: PropTypes.Requireable<(...args: any[]) => any>;
93
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
94
+ onMove: PropTypes.Requireable<(...args: any[]) => any>;
95
+ graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
96
+ scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
97
+ x: PropTypes.Validator<(...args: any[]) => any>;
98
+ y: PropTypes.Validator<(...args: any[]) => any>;
99
+ }>>>;
100
+ snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
101
+ x: PropTypes.Validator<(...args: any[]) => any>;
102
+ y: PropTypes.Validator<(...args: any[]) => any>;
103
+ }>>>;
104
+ domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
105
+ min: PropTypes.Validator<number>;
106
+ max: PropTypes.Validator<number>;
107
+ step: PropTypes.Requireable<number>;
108
+ }>>>;
109
+ range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
110
+ min: PropTypes.Validator<number>;
111
+ max: PropTypes.Validator<number>;
112
+ step: PropTypes.Requireable<number>;
113
+ }>>>;
114
+ size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
115
+ width: PropTypes.Validator<number>;
116
+ height: PropTypes.Validator<number>;
117
+ }>>>;
118
+ }>>>;
119
+ };
120
+ contextType?: React.Context<any> | undefined;
121
+ };
122
+ export default _default;
@@ -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 React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare const ArrowHead: {
12
+ ({ size, transform, points }: {
13
+ size: any;
14
+ transform: any;
15
+ points: any;
16
+ }): React.JSX.Element;
17
+ propTypes: {
18
+ points: PropTypes.Requireable<string>;
19
+ size: PropTypes.Requireable<number>;
20
+ transform: PropTypes.Requireable<string>;
21
+ };
22
+ defaultProps: {
23
+ points: string;
24
+ size: number;
25
+ transform: string;
26
+ };
27
+ };
28
+ export declare const genUid: () => string;
29
+ export declare const ArrowMarker: {
30
+ ({ id, size, className }: {
31
+ id: any;
32
+ size: any;
33
+ className: any;
34
+ }): React.JSX.Element;
35
+ propTypes: {
36
+ id: PropTypes.Requireable<string>;
37
+ size: PropTypes.Requireable<number>;
38
+ className: PropTypes.Requireable<string>;
39
+ };
40
+ defaultProps: {
41
+ size: number;
42
+ };
43
+ };
@@ -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 };