@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
@@ -1,471 +0,0 @@
1
- import React from 'react';
2
- import { cloneDeep, isEmpty, isEqual } from 'lodash-es';
3
- import { BasePoint } from '../point';
4
- import { gridDraggable, trig, types, utils } from '@pie-lib/plot';
5
- import PropTypes from 'prop-types';
6
- import { correct, disabled, incorrect, missing } from '../styles';
7
- import ReactDOM from 'react-dom';
8
- import MarkLabel from '../../../mark-label';
9
- import { color } from '@pie-lib/render-ui';
10
- import { equalPoints, getMiddleOfTwoPoints, sameAxes } from '../../../utils';
11
-
12
- export const lineTool = (type, Component) => () => ({
13
- type,
14
- Component,
15
- addPoint: (point, mark) => {
16
- if (mark && equalPoints(mark.root, point)) {
17
- return mark;
18
- }
19
-
20
- if (!mark) {
21
- return {
22
- type,
23
- building: true,
24
- from: point,
25
- };
26
- }
27
-
28
- if (equalPoints(point, mark.from)) {
29
- return { ...mark };
30
- }
31
-
32
- return { ...mark, building: false, to: point };
33
- },
34
- });
35
-
36
- export const lineToolComponent = (Component) => {
37
- return class LineToolComponent extends React.Component {
38
- static propTypes = {
39
- ...types.ToolPropTypeFields,
40
- graphProps: types.GraphPropsType.isRequired,
41
- };
42
-
43
- constructor(props) {
44
- super(props);
45
- this.state = {};
46
- }
47
-
48
- startDrag = () => this.setState({ mark: { ...this.props.mark } });
49
-
50
- stopDrag = () => {
51
- const { onChange, mark } = this.props;
52
- const update = { ...this.state.mark };
53
-
54
- this.setState({ mark: undefined }, () => {
55
- const { type } = update;
56
- let shouldNotChange =
57
- type &&
58
- (type === 'parabola' || type === 'sine' || type === 'absolute' || type === 'exponential') &&
59
- sameAxes(update.from, update.to);
60
- if (!shouldNotChange && type && type === 'exponential' && update.from && update.to) {
61
- shouldNotChange = update.from.y === 0 || update.to.y === 0 || update.from.y * update.to.y < 0;
62
- }
63
- if (!isEqual(mark, update) && !shouldNotChange) {
64
- onChange(mark, update);
65
- }
66
- });
67
- };
68
-
69
- changeMark = ({ from, to, middle }) => {
70
- let mark = { ...this.state.mark, from, to };
71
-
72
- if (middle) {
73
- mark = { ...mark, middle };
74
- }
75
-
76
- this.setState({ mark });
77
- };
78
-
79
- changeMarkProps = ({ from, to, middle }) => {
80
- const { onChange, mark } = this.props;
81
- let update = { ...mark, ...this.state.mark };
82
-
83
- if (from) {
84
- update = { ...update, from };
85
- }
86
-
87
- if (to) {
88
- update = { ...update, to };
89
- }
90
-
91
- if (middle) {
92
- update = { ...update, middle };
93
- }
94
-
95
- if (!isEqual(mark, update)) {
96
- onChange(mark, update);
97
- }
98
- };
99
-
100
- render() {
101
- const { graphProps, onClick, labelNode, labelModeEnabled, coordinatesOnHover, gssLineData } = this.props;
102
- const mark = this.state.mark ? this.state.mark : this.props.mark;
103
-
104
- const from = cloneDeep(mark.from);
105
- const to = cloneDeep(mark.to);
106
- const middle = cloneDeep(mark.middle);
107
-
108
- // SET DISABLED
109
- // if it's a background mark, we need to force disable it
110
- if (from && mark.isBackground) {
111
- from.disabled = true;
112
- }
113
-
114
- if (to && mark.isBackground) {
115
- to.disabled = true;
116
- }
117
-
118
- if (middle && mark.isBackground) {
119
- middle.disabled = true;
120
- }
121
-
122
- return (
123
- <Component
124
- disabled={mark.disabled}
125
- coordinatesOnHover={coordinatesOnHover}
126
- correctness={mark.correctness}
127
- from={from}
128
- to={to}
129
- middle={middle}
130
- graphProps={graphProps}
131
- fill={mark && mark.fill}
132
- gssLineData={gssLineData}
133
- onChange={this.changeMark}
134
- changeMarkProps={this.changeMarkProps}
135
- onClick={onClick}
136
- onDragStart={this.startDrag}
137
- onDragStop={this.stopDrag}
138
- labelNode={labelNode}
139
- labelModeEnabled={labelModeEnabled}
140
- />
141
- );
142
- }
143
- };
144
- };
145
-
146
- const dragOpts = () => ({
147
- bounds: (props, { domain, range }) => {
148
- const area = utils.lineToArea(props.from, props.to);
149
- return utils.bounds(area, domain, range);
150
- },
151
- anchorPoint: (props) => {
152
- const { from } = props;
153
- return from;
154
- },
155
- fromDelta: (props, delta) => {
156
- const { from, to } = props;
157
- return {
158
- from: utils.point(from).add(utils.point(delta)),
159
- to: utils.point(to).add(utils.point(delta)),
160
- };
161
- },
162
- });
163
-
164
- export const lineBase = (Comp, opts) => {
165
- const DraggableComp = gridDraggable(dragOpts())(Comp);
166
-
167
- const FromPoint = opts && opts.from ? opts.from : BasePoint;
168
- const ToPoint = opts && opts.to ? opts.to : BasePoint;
169
-
170
- class LineBase extends React.Component {
171
- static propTypes = {
172
- coordinatesOnHover: PropTypes.bool,
173
- graphProps: types.GraphPropsType,
174
- from: types.PointType,
175
- to: types.PointType,
176
- middle: types.PointType,
177
- onChange: PropTypes.func,
178
- onDragStart: PropTypes.func,
179
- onDragStop: PropTypes.func,
180
- onClick: PropTypes.func,
181
- correctness: PropTypes.string,
182
- fill: PropTypes.string,
183
- gssLineData: PropTypes.object,
184
- disabled: PropTypes.bool,
185
- labelNode: PropTypes.object,
186
- labelModeEnabled: PropTypes.bool,
187
- changeMarkProps: PropTypes.func,
188
- };
189
-
190
- onChangePoint = (point) => {
191
- const { middle, onChange } = this.props;
192
- const { from, to } = point;
193
-
194
- // because point.from.label and point.to.label can be different
195
- if (!equalPoints(from, to)) {
196
- if (middle) {
197
- point.middle = { ...middle, ...getMiddleOfTwoPoints(from, to) };
198
- }
199
-
200
- onChange(point);
201
- }
202
- };
203
-
204
- dragComp = ({ from: draggedFrom, to: draggedTo }) => {
205
- const { from, to, onChange, middle } = this.props;
206
-
207
- if (from.label) {
208
- draggedFrom.label = from.label;
209
- }
210
-
211
- if (to.label) {
212
- draggedTo.label = to.label;
213
- }
214
-
215
- const updated = { from: draggedFrom, to: draggedTo };
216
-
217
- if (middle) {
218
- updated.middle = { ...middle, ...getMiddleOfTwoPoints(draggedFrom, draggedTo) };
219
- }
220
-
221
- onChange(updated);
222
- };
223
-
224
- dragFrom = (draggedFrom) => {
225
- const { from, to } = this.props;
226
-
227
- if (from.label) {
228
- draggedFrom.label = from.label;
229
- }
230
-
231
- if (!equalPoints(draggedFrom, to)) {
232
- this.onChangePoint({ from: draggedFrom, to: to });
233
- }
234
- };
235
-
236
- dragTo = (draggedTo) => {
237
- const { from, to } = this.props;
238
-
239
- if (to.label) {
240
- draggedTo.label = to.label;
241
- }
242
-
243
- if (!equalPoints(from, draggedTo)) {
244
- this.onChangePoint({ from: from, to: draggedTo });
245
- }
246
- };
247
-
248
- labelChange = (point, type) => {
249
- const { changeMarkProps } = this.props;
250
- const update = { ...point };
251
-
252
- if (!point.label || isEmpty(point.label)) {
253
- delete update.label;
254
- }
255
-
256
- changeMarkProps({ [type]: update });
257
- };
258
-
259
- clickPoint = (point, type, data) => {
260
- const { changeMarkProps, disabled, from, to, labelModeEnabled, onClick } = this.props;
261
-
262
- if (!labelModeEnabled) {
263
- onClick(point || data);
264
- return;
265
- }
266
-
267
- if (disabled) {
268
- return;
269
- }
270
-
271
- if (type === 'middle' && !point && from && to) {
272
- point = { ...point, ...getMiddleOfTwoPoints(from, to) };
273
- }
274
-
275
- changeMarkProps({ from, to, [type]: { label: '', ...point } });
276
-
277
- if (this.input[type]) {
278
- this.input[type].focus();
279
- }
280
- };
281
-
282
- // IMPORTANT, do not remove
283
- input = {};
284
-
285
- render() {
286
- const {
287
- coordinatesOnHover,
288
- graphProps,
289
- fill,
290
- gssLineData,
291
- onDragStart,
292
- onDragStop,
293
- from,
294
- to,
295
- middle,
296
- disabled,
297
- correctness,
298
- onClick,
299
- labelNode,
300
- labelModeEnabled,
301
- } = this.props;
302
- let common = { graphProps, fill, onDragStart, onDragStop, disabled, correctness, onClick };
303
- if (gssLineData && gssLineData.selectedTool === 'solutionSet') {
304
- //removing dragging option for line if solution set is clicked.
305
- common = { graphProps, fill, disabled, correctness, onClick };
306
- }
307
- const angle = to ? trig.toDegrees(trig.angle(from, to)) : 0;
308
-
309
- let fromLabelNode = null;
310
- let toLabelNode = null;
311
- let lineLabelNode = null;
312
-
313
- if (labelNode) {
314
- if (from && Object.prototype.hasOwnProperty.call(from, 'label')) {
315
- fromLabelNode = ReactDOM.createPortal(
316
- <MarkLabel
317
- inputRef={(r) => (this.input.from = r)}
318
- disabled={!labelModeEnabled}
319
- mark={from}
320
- graphProps={graphProps}
321
- onChange={(label) => this.labelChange({ ...from, label }, 'from')}
322
- />,
323
- labelNode,
324
- );
325
- }
326
-
327
- if (to && Object.prototype.hasOwnProperty.call(to, 'label')) {
328
- toLabelNode = ReactDOM.createPortal(
329
- <MarkLabel
330
- inputRef={(r) => (this.input.to = r)}
331
- disabled={!labelModeEnabled}
332
- mark={to}
333
- graphProps={graphProps}
334
- onChange={(label) => this.labelChange({ ...to, label }, 'to')}
335
- />,
336
- labelNode,
337
- );
338
- }
339
-
340
- if (middle && Object.prototype.hasOwnProperty.call(middle, 'label')) {
341
- lineLabelNode = ReactDOM.createPortal(
342
- <MarkLabel
343
- inputRef={(r) => (this.input.middle = r)}
344
- disabled={!labelModeEnabled}
345
- mark={middle}
346
- graphProps={graphProps}
347
- onChange={(label) => this.labelChange({ ...middle, label }, 'middle')}
348
- />,
349
- labelNode,
350
- );
351
- }
352
- }
353
- if (gssLineData && gssLineData.selectedTool === 'solutionSet') {
354
- //removing dragging feature of line and point if solution set is true.
355
- return (
356
- <g>
357
- {to && <DraggableComp from={from} to={to} middle={middle} {...common} />}
358
- {lineLabelNode}
359
-
360
- <FromPoint
361
- x={from.x}
362
- y={from.y}
363
- labelNode={labelNode}
364
- coordinatesOnHover={coordinatesOnHover}
365
- {...common}
366
- />
367
- {fromLabelNode}
368
-
369
- {to && (
370
- <ToPoint
371
- x={to.x}
372
- y={to.y}
373
- angle={angle} //angle + 45}
374
- labelNode={labelNode}
375
- coordinatesOnHover={coordinatesOnHover}
376
- {...common}
377
- />
378
- )}
379
- {toLabelNode}
380
- </g>
381
- );
382
- } else {
383
- return (
384
- <g>
385
- {to && (
386
- <DraggableComp
387
- from={from}
388
- to={to}
389
- middle={middle}
390
- onDrag={this.dragComp}
391
- {...common}
392
- onClick={(data) => this.clickPoint(middle, 'middle', data)}
393
- />
394
- )}
395
- {lineLabelNode}
396
-
397
- <FromPoint
398
- x={from.x}
399
- y={from.y}
400
- labelNode={labelNode}
401
- coordinatesOnHover={coordinatesOnHover}
402
- onDrag={this.dragFrom}
403
- {...common}
404
- onClick={(data) => this.clickPoint(from, 'from', data)}
405
- />
406
- {fromLabelNode}
407
-
408
- {to && (
409
- <ToPoint
410
- x={to.x}
411
- y={to.y}
412
- angle={angle} //angle + 45}
413
- labelNode={labelNode}
414
- coordinatesOnHover={coordinatesOnHover}
415
- onDrag={this.dragTo}
416
- {...common}
417
- onClick={(data) => this.clickPoint(to, 'to', data)}
418
- />
419
- )}
420
- {toLabelNode}
421
- </g>
422
- );
423
- }
424
- }
425
- }
426
-
427
- return LineBase;
428
- };
429
-
430
- export const styles = {
431
- line: () => ({
432
- fill: 'transparent',
433
- stroke: color.defaults.BLACK,
434
- strokeWidth: 4,
435
- transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
436
- '&:hover': {
437
- strokeWidth: 6,
438
- stroke: color.defaults.BLACK,
439
- },
440
- }),
441
- dashedLine: () => ({
442
- fill: 'transparent',
443
- stroke: color.defaults.BLACK,
444
- strokeWidth: 4,
445
- transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',
446
- '&:hover': {
447
- strokeWidth: 6,
448
- stroke: color.defaults.BLACK,
449
- },
450
- strokeDasharray: '3,3',
451
- }),
452
- arrow: () => ({
453
- fill: color.defaults.SECONDARY,
454
- }),
455
- disabledArrow: () => ({
456
- ...disabled(),
457
- }),
458
- disabled: () => ({
459
- ...disabled('stroke'),
460
- strokeWidth: 2,
461
- }),
462
- correct: (theme, key) => ({
463
- ...correct(key),
464
- }),
465
- incorrect: (theme, key) => ({
466
- ...incorrect(key),
467
- }),
468
- missing: (theme, key) => ({
469
- ...missing(key),
470
- }),
471
- };
@@ -1,85 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@mui/material/styles';
4
- import { types } from '@pie-lib/plot';
5
- import { correct, disabled, incorrect, missing } from '../styles';
6
- import * as vx from '@visx/shape';
7
- import { color } from '@pie-lib/render-ui';
8
-
9
- const dragging = () => ({
10
- strokeWidth: 7,
11
- stroke: color.defaults.BLACK,
12
- });
13
-
14
- const StyledDrawLine = styled(vx.LinePath, {
15
- shouldForwardProp: (prop) => !['disabled', 'correctness'].includes(prop),
16
- })(({ disabled: isDisabled, correctness }) => ({
17
- fill: 'none',
18
- strokeWidth: 2,
19
- stroke: color.secondaryLight(),
20
- ...(isDisabled && {
21
- ...disabled('stroke'),
22
- strokeWidth: 2,
23
- }),
24
- ...(correctness === 'correct' && correct('stroke')),
25
- ...(correctness === 'incorrect' && incorrect('stroke')),
26
- ...(correctness === 'missing' && missing('stroke')),
27
- }));
28
-
29
- const StyledInteractionLine = styled(vx.LinePath, {
30
- shouldForwardProp: (prop) => !['disabled', 'correctness', 'isDragging'].includes(prop),
31
- })(({ disabled: isDisabled, correctness, isDragging }) => ({
32
- strokeWidth: 6,
33
- fill: 'none',
34
- transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',
35
- stroke: 'transparent',
36
- '&:hover': dragging(),
37
- ...(isDragging && dragging()),
38
- ...(isDisabled && {
39
- ...disabled('stroke'),
40
- strokeWidth: 2,
41
- }),
42
- ...(correctness === 'correct' && correct('stroke')),
43
- ...(correctness === 'incorrect' && incorrect('stroke')),
44
- ...(correctness === 'missing' && missing('stroke')),
45
- }));
46
-
47
- export class RawLinePath extends React.Component {
48
- static propTypes = {
49
- className: PropTypes.string,
50
- data: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),
51
- graphProps: types.GraphPropsType.isRequired,
52
- disabled: PropTypes.bool,
53
- correctness: PropTypes.string,
54
- from: types.PointType,
55
- to: types.PointType,
56
- isDragging: PropTypes.bool,
57
- };
58
-
59
- static defaultProps = {
60
- from: {},
61
- to: {},
62
- };
63
-
64
- render() {
65
- /* eslint-disable no-unused-vars */
66
- const { data, className, disabled, correctness, from, to, graphProps, isDragging, ...rest } = this.props;
67
- /* eslint-enable */
68
-
69
- return (
70
- <React.Fragment>
71
- <StyledDrawLine data={data} disabled={disabled} correctness={correctness} className={className} {...rest} />
72
- <StyledInteractionLine
73
- data={data}
74
- isDragging={isDragging}
75
- disabled={disabled}
76
- correctness={correctness}
77
- className={className}
78
- {...rest}
79
- />
80
- </React.Fragment>
81
- );
82
- }
83
- }
84
-
85
- export const LinePath = RawLinePath;
@@ -1,97 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { types } from '@pie-lib/plot';
4
- import { LinePath } from './line-path';
5
- import { curveMonotoneX } from '@visx/curve';
6
- import { lineBase, lineToolComponent } from './index';
7
-
8
- const toRootEdge = (m) => {
9
- const out = { ...m };
10
- out.root = { ...m.from };
11
- out.edge = m.to ? { ...m.to } : undefined;
12
- delete out.from;
13
- delete out.to;
14
- return out;
15
- };
16
-
17
- const toFromTo = (m) => {
18
- const out = { ...m };
19
- out.from = { ...m.root };
20
- out.to = m.edge ? { ...m.edge } : undefined;
21
- delete out.root;
22
- delete out.edge;
23
- return out;
24
- };
25
-
26
- export const rootEdgeToFromToWrapper = (BaseComp) => {
27
- const Wrapper = (props) => {
28
- const m = toFromTo(props.mark);
29
-
30
- const onChange = (current, next) => {
31
- props.onChange(toRootEdge(current), toRootEdge(next));
32
- };
33
-
34
- return <BaseComp {...props} mark={m} onChange={onChange} />;
35
- };
36
-
37
- Wrapper.propTypes = {
38
- onChange: PropTypes.func,
39
- mark: PropTypes.object,
40
- };
41
-
42
- return Wrapper;
43
- };
44
-
45
- export const rootEdgeComponent = (RootEdgeComp) => {
46
- const BaseComponent = lineToolComponent(RootEdgeComp);
47
- return rootEdgeToFromToWrapper(BaseComponent);
48
- };
49
-
50
- const withPointsGenerationLinePath = (getPoints) => {
51
- const LinePathComponent = (props) => {
52
- const { graphProps, from, to, onClick, onDragStart, onDragStop, onChange, disabled, correctness, ...rest } = props;
53
-
54
- const { dataPoints, enableCurve = true } = getPoints({
55
- graphProps: props.graphProps,
56
- root: from,
57
- edge: to,
58
- });
59
-
60
- const raw = dataPoints.map((d) => [graphProps.scale.x(d.x), graphProps.scale.y(d.y)]);
61
-
62
- const common = {
63
- onClick,
64
- graphProps,
65
- onDragStart,
66
- onDragStop,
67
- onChange,
68
- disabled,
69
- correctness,
70
- };
71
-
72
- if (!enableCurve) {
73
- return <LinePath data={raw} from={from} to={to} {...common} {...rest} />;
74
- } else {
75
- return <LinePath data={raw} from={from} to={to} curve={curveMonotoneX} {...common} {...rest} />;
76
- }
77
- };
78
-
79
- LinePathComponent.propTypes = {
80
- graphProps: types.GraphPropsType.isRequired,
81
- from: types.PointType.isRequired,
82
- to: types.PointType,
83
- onClick: PropTypes.func,
84
- onDragStart: PropTypes.func,
85
- onDragStop: PropTypes.func,
86
- onChange: PropTypes.func,
87
- disabled: PropTypes.bool,
88
- correctness: PropTypes.string,
89
- };
90
-
91
- return LinePathComponent;
92
- };
93
-
94
- export const withRootEdge = (getPoints) => {
95
- const LinePathComp = withPointsGenerationLinePath(getPoints);
96
- return lineBase(LinePathComp);
97
- };