@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,70 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/point/arrow-point.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 classNames from 'classnames';
14
+ import { types } from '@pie-lib/plot';
15
+ import { isEqual } from 'lodash-es';
16
+ import { arrowDimensions, getAngleDeg } from '../../../utils.js';
17
+
18
+ export class RawArrow extends React.Component {
19
+ static propTypes = {
20
+ classes: PropTypes.object,
21
+ className: PropTypes.string,
22
+ correctness: PropTypes.string,
23
+ disabled: PropTypes.bool,
24
+ x: PropTypes.number,
25
+ y: PropTypes.number,
26
+ from: PropTypes.shape({
27
+ x: PropTypes.number,
28
+ y: PropTypes.number,
29
+ }).isRequired,
30
+ to: PropTypes.shape({
31
+ x: PropTypes.number,
32
+ y: PropTypes.number,
33
+ }),
34
+ graphProps: types.GraphPropsType.isRequired,
35
+ };
36
+
37
+ static defaultProps = {
38
+ from: {},
39
+ to: {},
40
+ };
41
+
42
+ render() {
43
+ const { classes, className, x, y, disabled, correctness, graphProps, from, to, ...rest } = this.props;
44
+ // x & y are the initial coordinates for the arrow
45
+ // from & to are used only to calculate the angle that the arrow should be rotated with
46
+
47
+ const { scale } = graphProps;
48
+ const angle = getAngleDeg(from.x, from.y, to.x, to.y);
49
+
50
+ let points = '';
51
+
52
+ if (isEqual(from, to)) {
53
+ points = '0,0 0,0 0,0';
54
+ } else {
55
+ points = `0,0 ${arrowDimensions.vector},${arrowDimensions.vector * 2}
56
+ -${arrowDimensions.vector},${arrowDimensions.vector * 2}`;
57
+ }
58
+
59
+ return (
60
+ <g className={classNames(classes.point, disabled && classes.disabled, classes[correctness], className)} {...rest}>
61
+ <polygon
62
+ points={points}
63
+ transform={`
64
+ translate(${scale.x(x)}, ${scale.y(y)})
65
+ rotate(${angle} 0 0)`}
66
+ />
67
+ </g>
68
+ );
69
+ }
70
+ }
@@ -0,0 +1,50 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/point/arrow.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 classNames from 'classnames';
14
+ import { types } from '@pie-lib/plot';
15
+ import { ArrowHead } from '../arrow-head.js';
16
+ import { thinnerShapesNeeded } from '../../../utils.js';
17
+
18
+ export default class Arrow extends React.Component {
19
+ static propTypes = {
20
+ classes: PropTypes.object,
21
+ className: PropTypes.string,
22
+ correctness: PropTypes.string,
23
+ disabled: PropTypes.bool,
24
+ x: PropTypes.number.isRequired,
25
+ y: PropTypes.number.isRequired,
26
+ angle: PropTypes.number.isRequired,
27
+ graphProps: types.GraphPropsType.isRequired,
28
+ };
29
+
30
+ render() {
31
+ const { classes, angle, className, x, y, disabled, correctness, graphProps, ...rest } = this.props;
32
+
33
+ const size = thinnerShapesNeeded(graphProps) ? 12 : 14;
34
+ const { scale } = graphProps;
35
+
36
+ const scaledX = scale.x(x);
37
+ const scaledY = scale.y(y);
38
+
39
+ const transform = `rotate(${-angle}, ${scaledX},${scaledY})`;
40
+ const points = `${scaledX},${scaledY}
41
+ ${scaledX - size},${scaledY - size / 2}
42
+ ${scaledX - size}, ${scaledY + size / 2}`;
43
+
44
+ return (
45
+ <g className={classNames(classes.point, disabled && classes.disabled, classes[correctness], className)} {...rest}>
46
+ <ArrowHead size={size} transform={transform} points={points} />
47
+ </g>
48
+ );
49
+ }
50
+ }
@@ -0,0 +1,123 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/point/base-point.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 { types } from '@pie-lib/plot';
14
+ import CoordinatesLabel from '../../../coordinates-label.js';
15
+ import ReactDOM from 'react-dom';
16
+ import { thinnerShapesNeeded } from '../../../utils.js';
17
+ import { color } from '@pie-lib/render-ui';
18
+ import { styled } from '@mui/material/styles';
19
+ import { correct, disabled as disabledStyle, incorrect, missing } from '../styles.js';
20
+
21
+ const StyledPointGroup: any = styled('g')(({ disabled, correctness }) => ({
22
+ cursor: 'pointer',
23
+ '& circle': {
24
+ fill: 'currentColor',
25
+ },
26
+ ...(disabled && {
27
+ ...disabledStyle('fill'),
28
+ ...disabledStyle('color'),
29
+ }),
30
+ ...(correctness === 'correct' && {
31
+ ...correct('fill'),
32
+ ...correct('color'),
33
+ }),
34
+ ...(correctness === 'incorrect' && {
35
+ ...incorrect('fill'),
36
+ ...incorrect('color'),
37
+ }),
38
+ ...(correctness === 'missing' && {
39
+ ...missing('fill'),
40
+ ...missing('color'),
41
+ }),
42
+ }));
43
+
44
+ export class RawBp extends React.Component {
45
+ static propTypes = {
46
+ className: PropTypes.string,
47
+ coordinatesOnHover: PropTypes.bool,
48
+ correctness: PropTypes.string,
49
+ disabled: PropTypes.bool,
50
+ labelNode: PropTypes.object,
51
+ x: PropTypes.number,
52
+ y: PropTypes.number,
53
+ graphProps: types.GraphPropsType.isRequired,
54
+ onClick: PropTypes.func,
55
+ onTouchStart: PropTypes.func,
56
+ onTouchEnd: PropTypes.func,
57
+ };
58
+
59
+ constructor(props) {
60
+ super(props);
61
+ this.state = { showCoordinates: false };
62
+ }
63
+
64
+ render() {
65
+ const {
66
+ className,
67
+ coordinatesOnHover,
68
+ x,
69
+ y,
70
+ disabled,
71
+ correctness,
72
+ graphProps,
73
+ labelNode,
74
+ // we need to remove style from props
75
+ // eslint-disable-next-line no-unused-vars,react/prop-types
76
+ style,
77
+ onClick,
78
+ // Refactored RawBp component by isolating onTouchStart and onTouchEnd handlers to the outer circle, resolving erratic touch event behavior.
79
+ // Remaining props are now applied only to the inner circle for improved event handling consistency.
80
+ onTouchStart,
81
+ onTouchEnd,
82
+ ...rest
83
+ } = this.props;
84
+ const { showCoordinates } = this.state;
85
+ const { scale } = graphProps;
86
+ const r = thinnerShapesNeeded(graphProps) ? 5 : 7;
87
+
88
+ return (
89
+ <>
90
+ <circle
91
+ style={{ fill: 'transparent', cursor: 'pointer', pointerEvents: 'all' }}
92
+ r={r * 3}
93
+ cx={scale.x(x)}
94
+ cy={scale.y(y)}
95
+ onMouseEnter={() => this.setState({ showCoordinates: true })}
96
+ onMouseLeave={() => this.setState({ showCoordinates: false })}
97
+ onTouchStart={onTouchStart}
98
+ onTouchEnd={onTouchEnd}
99
+ onClick={onClick}
100
+ />
101
+ <StyledPointGroup
102
+ disabled={disabled}
103
+ correctness={correctness}
104
+ className={className}
105
+ onMouseEnter={() => this.setState({ showCoordinates: true })}
106
+ onMouseLeave={() => this.setState({ showCoordinates: false })}
107
+ >
108
+ <circle
109
+ {...rest}
110
+ style={{ fill: color.defaults.BLACK, cursor: 'pointer' }}
111
+ r={r}
112
+ cx={scale.x(x)}
113
+ cy={scale.y(y)}
114
+ />
115
+ {labelNode &&
116
+ coordinatesOnHover &&
117
+ showCoordinates &&
118
+ ReactDOM.createPortal(<CoordinatesLabel graphProps={graphProps} x={x} y={y} />, labelNode)}
119
+ </StyledPointGroup>
120
+ </>
121
+ );
122
+ }
123
+ }
@@ -0,0 +1,68 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/point/index.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 } from '@pie-lib/plot';
15
+ import * as utils from '../../../utils.js';
16
+ import { correct, disabled, incorrect, missing } from '../styles.js';
17
+ import { RawBp } from './base-point.js';
18
+ import { RawArrow } from './arrow-point.js';
19
+ import { color } from '@pie-lib/render-ui';
20
+ import BaseArrow from './arrow.js';
21
+
22
+ const opts = {
23
+ bounds: (props, { domain, range }) => {
24
+ const { x, y } = props;
25
+ const area = { left: x, top: y, bottom: y, right: x };
26
+
27
+ return utils.bounds(area, domain, range);
28
+ },
29
+ anchorPoint: (props) => {
30
+ const { x, y } = props;
31
+
32
+ return { x, y };
33
+ },
34
+ fromDelta: (props, delta) => {
35
+ return utils.point(props).add(utils.point(delta));
36
+ },
37
+ };
38
+
39
+ const StyledPointWrapper: any = styled('g', {
40
+ shouldForwardProp: (prop) => !['disabled', 'correctness'].includes(prop),
41
+ })(({ disabled: isDisabled, correctness }) => ({
42
+ '& circle, & polygon': {
43
+ cursor: 'pointer',
44
+ fill: color.defaults.SECONDARY,
45
+ ...(isDisabled && disabled()),
46
+ ...(correctness === 'correct' && correct()),
47
+ ...(correctness === 'incorrect' && incorrect()),
48
+ ...(correctness === 'missing' && missing()),
49
+ },
50
+ }));
51
+
52
+ const withStyledWrapper = (WrappedComponent) => {
53
+ const WrappedComponentWithStyles = (props) => (
54
+ <StyledPointWrapper disabled={props.disabled} correctness={props.correctness}>
55
+ <WrappedComponent {...props} />
56
+ </StyledPointWrapper>
57
+ );
58
+ WrappedComponentWithStyles.displayName = `withStyledWrapper(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
59
+ WrappedComponentWithStyles.propTypes = {
60
+ disabled: PropTypes.bool,
61
+ correctness: PropTypes.string,
62
+ };
63
+ return WrappedComponentWithStyles;
64
+ };
65
+
66
+ export const BasePoint = gridDraggable(opts)(withStyledWrapper(RawBp));
67
+ export const ArrowPoint = gridDraggable(opts)(withStyledWrapper(RawArrow));
68
+ export const Arrow = gridDraggable(opts)(withStyledWrapper(BaseArrow));
@@ -0,0 +1,30 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/styles.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 { color } from '@pie-lib/render-ui';
12
+
13
+ export const disabled = (key = 'fill') => ({
14
+ [key]: color.disabled(),
15
+ pointerEvents: 'none',
16
+ });
17
+
18
+ export const correct = (key = 'fill') => ({
19
+ [key]: color.correct(),
20
+ pointerEvents: 'none',
21
+ });
22
+ export const incorrect = (key = 'fill') => ({
23
+ [key]: color.incorrect(),
24
+ pointerEvents: 'none',
25
+ });
26
+
27
+ export const missing = (key = 'fill') => ({
28
+ [key]: color.missing(),
29
+ pointerEvents: 'none',
30
+ });
@@ -0,0 +1,18 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/tools/shared/types.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 PropTypes from 'prop-types';
12
+
13
+ export const ToolPropTypeFields = {
14
+ mark: PropTypes.any,
15
+ onChange: PropTypes.func,
16
+ onDragStart: PropTypes.func,
17
+ onDragStop: PropTypes.func,
18
+ };
@@ -0,0 +1,47 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/undo-redo.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 Button from '@mui/material/Button';
15
+ import { color } from '@pie-lib/render-ui';
16
+ import Translator from '@pie-lib/translator';
17
+
18
+ const { translator } = Translator;
19
+
20
+ const StyledButton: any = styled(Button)(({ theme }) => ({
21
+ color: color.text(),
22
+ fontWeight: 'bold',
23
+ marginBottom: theme.spacing(0.5),
24
+ '&:not(:last-of-type)': {
25
+ marginRight: theme.spacing(0.5),
26
+ },
27
+ }));
28
+
29
+ export class UndoRedo extends React.Component {
30
+ static propTypes = {
31
+ className: PropTypes.string,
32
+ onReset: PropTypes.func.isRequired,
33
+ language: PropTypes.string,
34
+ };
35
+ static defaultProps = {};
36
+
37
+ render() {
38
+ const { className, onReset = false, language } = this.props;
39
+ return (
40
+ <div className={className}>
41
+ <StyledButton onClick={() => onReset()}>{translator.t('graphing.reset', { lng: language })}</StyledButton>
42
+ </div>
43
+ );
44
+ }
45
+ }
46
+
47
+ export default UndoRedo;
@@ -0,0 +1,23 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/use-debounce.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 { useEffect, useState } from 'react';
12
+
13
+ export const useDebounce = (value, delay) => {
14
+ const [debouncedValue, setDebouncedValue] = useState(value);
15
+
16
+ useEffect(() => {
17
+ const handler = setTimeout(() => {
18
+ setDebouncedValue(value);
19
+ }, delay);
20
+ return () => clearTimeout(handler);
21
+ }, [value]);
22
+ return debouncedValue;
23
+ };
package/src/utils.ts ADDED
@@ -0,0 +1,240 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/utils.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 { cloneDeep, head, isEmpty, isEqual, tail } from 'lodash-es';
12
+ import { utils } from '@pie-lib/plot';
13
+ import invariant from 'invariant';
14
+
15
+ export const bounds = utils.bounds;
16
+ export const point = utils.point;
17
+
18
+ //TODO: This can be removed?
19
+ export const getAngleDeg = () => 0;
20
+ //TODO: This can be removed?
21
+ export const arrowDimensions = () => 0;
22
+
23
+ export const getTickValues = (prop) => {
24
+ const tickValues = [];
25
+ let tickVal = 0;
26
+
27
+ while (tickVal >= prop.min && tickValues.indexOf(tickVal) < 0) {
28
+ tickValues.push(tickVal);
29
+ tickVal = Math.round((tickVal - prop.step) * 10000) / 10000;
30
+ }
31
+
32
+ tickVal = Math.round(prop.step * 10000) / 10000;
33
+
34
+ while (tickVal <= prop.max && tickValues.indexOf(tickVal) < 0) {
35
+ tickValues.push(tickVal);
36
+ tickVal = Math.round((tickVal + prop.step) * 10000) / 10000;
37
+ }
38
+
39
+ // return only ticks that are inside the min-max interval
40
+ if (tickValues) {
41
+ return tickValues.filter((tV) => tV >= prop.min && tV <= prop.max);
42
+ }
43
+
44
+ return [];
45
+ };
46
+
47
+ export const countWords = (label) => {
48
+ if (label == null || isEmpty(label)) {
49
+ return 1;
50
+ }
51
+
52
+ const words = label.split(' ');
53
+ return words.length;
54
+ };
55
+
56
+ // findLongestWord is also used in plot
57
+ export const findLongestWord = (label) => {
58
+ let longestWord = (label || '')
59
+ .replace(/<[^>]+>/g, '')
60
+ .split(' ')
61
+ .sort((a, b) => b.length - a.length);
62
+
63
+ return longestWord[0].length;
64
+ };
65
+
66
+ // amountToIncreaseWidth is also used in plot
67
+ export const amountToIncreaseWidth = (longestWord) => {
68
+ if (!longestWord) {
69
+ return 0;
70
+ }
71
+
72
+ return longestWord * 10;
73
+ };
74
+
75
+ export const polygonToArea = (points) => {
76
+ const h = head(points);
77
+ const area = {
78
+ left: h.x,
79
+ top: h.y,
80
+ bottom: h.y,
81
+ right: h.x,
82
+ };
83
+ return tail(points).reduce((a, p) => {
84
+ a.left = Math.min(a.left, p.x);
85
+ a.top = Math.max(a.top, p.y);
86
+ a.bottom = Math.min(a.bottom, p.y);
87
+ a.right = Math.max(a.right, p.x);
88
+ return a;
89
+ }, area);
90
+ };
91
+
92
+ export const lineToArea = (from, to) => pointsToArea(from, to);
93
+
94
+ export const pointsToArea = (a, b) => {
95
+ invariant(!!a && !!b, 'a or b is undefined');
96
+ const left = Math.min(a.x, b.x);
97
+ const top = Math.max(a.y, b.y);
98
+ const bottom = Math.min(a.y, b.y);
99
+ const right = Math.max(a.x, b.x);
100
+ return { left, top, bottom, right };
101
+ };
102
+
103
+ export const getRightestPoints = (points) => {
104
+ const sortedPoints = cloneDeep(points);
105
+ sortedPoints.sort((a, b) => b.x - a.x);
106
+
107
+ return { a: sortedPoints[0], b: sortedPoints[1] };
108
+ };
109
+
110
+ export const getMiddleOfTwoPoints = (a, b) => ({
111
+ x: (a.x + b.x) / 2,
112
+ y: (a.y + b.y) / 2,
113
+ });
114
+
115
+ export const roundNumber = (number) => parseFloat(number.toFixed(4));
116
+
117
+ export const sameAxes = (p1, p2) =>
118
+ p1 && p2 && (roundNumber(p1.x) === roundNumber(p2.x) || roundNumber(p1.y) === roundNumber(p2.y));
119
+
120
+ export const equalPoints = (p1, p2) =>
121
+ p1 &&
122
+ p2 &&
123
+ isEqual(
124
+ {
125
+ x: roundNumber(p1.x),
126
+ y: roundNumber(p1.y),
127
+ },
128
+ {
129
+ x: roundNumber(p2.x),
130
+ y: roundNumber(p2.y),
131
+ },
132
+ );
133
+
134
+ const getDistanceBetweenTicks = (axis, size) => {
135
+ const { min, max, step } = axis;
136
+ const nbOfTicks = (max - min) / step;
137
+
138
+ return size / nbOfTicks;
139
+ };
140
+
141
+ export const thinnerShapesNeeded = (graphProps) => {
142
+ const {
143
+ domain,
144
+ range,
145
+ size: { width, height },
146
+ } = graphProps;
147
+
148
+ // 14 is the default width of a point
149
+ return getDistanceBetweenTicks(domain, width) < 14 || getDistanceBetweenTicks(range, height) < 14;
150
+ };
151
+
152
+ export const getAdjustedGraphLimits = (graphProps) => {
153
+ const {
154
+ domain,
155
+ range,
156
+ size: { width, height },
157
+ } = graphProps;
158
+ const domainTicksDistance = getDistanceBetweenTicks(domain, width);
159
+ const rangeTicksDistance = getDistanceBetweenTicks(range, height);
160
+
161
+ // 15 is the distance required for the arrow to extend the graph
162
+ const domainPadding = domain.step / (domainTicksDistance / 15);
163
+ const rangePadding = range.step / (rangeTicksDistance / 15);
164
+
165
+ return {
166
+ domain: {
167
+ min: domain.min - domainPadding,
168
+ max: domain.max + domainPadding,
169
+ },
170
+ range: {
171
+ min: range.min - rangePadding,
172
+ max: range.max + rangePadding,
173
+ },
174
+ };
175
+ };
176
+
177
+ const sortPoints = (array) => (array || []).sort((a, b) => a.x - b.x || a.y - b.y);
178
+
179
+ // check colliniarity of 3 points (source: https://www.geeksforgeeks.org/program-check-three-points-collinear/)
180
+ const checkCollinearity = (a, b, c) => (a.x - b.x) * (c.y - b.y) === (c.x - b.x) * (a.y - b.y);
181
+
182
+ // 2 lines are overlapping if all 4 points are collinear
183
+ const isSameLine = (markA, markB) =>
184
+ checkCollinearity(markA.from, markB.from, markB.to) && checkCollinearity(markA.to, markB.from, markB.to);
185
+
186
+ export const isDuplicatedMark = (mark, marks, oldMark) => {
187
+ const { type, building } = mark;
188
+
189
+ if (building) {
190
+ return false;
191
+ }
192
+
193
+ const filteredMarks = (marks || []).filter((m) => m.type === type && !m.building);
194
+ const index = filteredMarks.findIndex((m) => isEqual(m, oldMark));
195
+
196
+ if (index !== -1) {
197
+ filteredMarks.splice(index, 1);
198
+ }
199
+
200
+ const duplicated = filteredMarks.find((m) => {
201
+ if (type === 'line') {
202
+ const { from, to } = mark;
203
+ return (
204
+ (equalPoints(from, m.from) && equalPoints(to, m.to)) ||
205
+ (equalPoints(from, m.to) && equalPoints(to, m.from)) ||
206
+ (type === 'line' && isSameLine(m, mark))
207
+ );
208
+ } else if (type === 'polygon') {
209
+ return isEqual(sortPoints(cloneDeep(mark.points)), sortPoints(cloneDeep(m.points)));
210
+ }
211
+ });
212
+
213
+ return !!duplicated;
214
+ };
215
+
216
+ export const areArraysOfObjectsEqual = (array1, array2) => {
217
+ // Check if both arrays have the same length
218
+ if (array1.length !== array2.length) {
219
+ return false;
220
+ }
221
+ // Iterate through each object in the arrays
222
+ for (let i = 0; i < array1.length; i++) {
223
+ // Get the current objects in both arrays
224
+ const obj1 = array1[i];
225
+ const obj2 = array2[i];
226
+ // Check if the objects have the same number of properties
227
+ if (Object.keys(obj1).length !== Object.keys(obj2).length) {
228
+ return false;
229
+ }
230
+ // Iterate through each property in the objects
231
+ for (const key in obj1) {
232
+ // Check if the properties and their values are equal
233
+ if (obj1[key] !== obj2[key]) {
234
+ return false;
235
+ }
236
+ }
237
+ }
238
+ // If all objects are equal, the arrays are the same
239
+ return true;
240
+ };