@pie-element/number-line 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 (352) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/author/arrows.d.ts +29 -0
  3. package/dist/author/arrows.d.ts.map +1 -0
  4. package/dist/author/arrows.js +69 -0
  5. package/dist/author/card-bar.d.ts +21 -0
  6. package/dist/author/card-bar.d.ts.map +1 -0
  7. package/dist/author/card-bar.js +41 -0
  8. package/dist/author/defaults.d.ts +179 -0
  9. package/dist/author/defaults.d.ts.map +1 -0
  10. package/dist/author/defaults.js +144 -0
  11. package/dist/author/domain.d.ts +16 -0
  12. package/dist/author/domain.d.ts.map +1 -0
  13. package/dist/author/domain.js +53 -0
  14. package/dist/author/index.d.ts +24 -0
  15. package/dist/author/index.d.ts.map +1 -0
  16. package/dist/author/index.js +89 -0
  17. package/dist/author/main.d.ts +45 -0
  18. package/dist/author/main.d.ts.map +1 -0
  19. package/dist/author/main.js +482 -0
  20. package/dist/author/number-text-field.d.ts +14 -0
  21. package/dist/author/number-text-field.d.ts.map +1 -0
  22. package/dist/author/number-text-field.js +11 -0
  23. package/dist/author/point-config.d.ts +26 -0
  24. package/dist/author/point-config.d.ts.map +1 -0
  25. package/dist/author/point-config.js +69 -0
  26. package/dist/author/size.d.ts +25 -0
  27. package/dist/author/size.d.ts.map +1 -0
  28. package/dist/author/size.js +48 -0
  29. package/dist/author/ticks.d.ts +23 -0
  30. package/dist/author/ticks.d.ts.map +1 -0
  31. package/dist/author/ticks.js +115 -0
  32. package/dist/author/utils.d.ts +10 -0
  33. package/dist/author/utils.d.ts.map +1 -0
  34. package/dist/author/utils.js +4 -0
  35. package/dist/controller/defaults.d.ts +59 -0
  36. package/dist/controller/defaults.d.ts.map +1 -0
  37. package/dist/controller/defaults.js +50 -0
  38. package/dist/controller/index.d.ts +34 -0
  39. package/dist/controller/index.d.ts.map +1 -0
  40. package/dist/controller/index.js +170 -0
  41. package/dist/controller/tickUtils.d.ts +21 -0
  42. package/dist/controller/tickUtils.d.ts.map +1 -0
  43. package/dist/controller/tickUtils.js +254 -0
  44. package/dist/controller/utils.d.ts +10 -0
  45. package/dist/controller/utils.d.ts.map +1 -0
  46. package/dist/controller/utils.js +68 -0
  47. package/dist/delivery/data-converter.d.ts +65 -0
  48. package/dist/delivery/data-converter.d.ts.map +1 -0
  49. package/dist/delivery/data-converter.js +70 -0
  50. package/dist/delivery/draggable/index.d.ts +34 -0
  51. package/dist/delivery/draggable/index.d.ts.map +1 -0
  52. package/dist/delivery/draggable/index.js +39 -0
  53. package/dist/delivery/index.d.ts +36 -0
  54. package/dist/delivery/index.d.ts.map +1 -0
  55. package/dist/delivery/index.js +109 -0
  56. package/dist/delivery/number-line/colors.d.ts +12 -0
  57. package/dist/delivery/number-line/colors.d.ts.map +1 -0
  58. package/dist/delivery/number-line/colors.js +5 -0
  59. package/dist/delivery/number-line/feedback.d.ts +20 -0
  60. package/dist/delivery/number-line/feedback.d.ts.map +1 -0
  61. package/dist/delivery/number-line/feedback.js +57 -0
  62. package/dist/delivery/number-line/graph/arrow.d.ts +31 -0
  63. package/dist/delivery/number-line/graph/arrow.d.ts.map +1 -0
  64. package/dist/delivery/number-line/graph/arrow.js +27 -0
  65. package/dist/delivery/number-line/graph/elements/base.d.ts +17 -0
  66. package/dist/delivery/number-line/graph/elements/base.d.ts.map +1 -0
  67. package/dist/delivery/number-line/graph/elements/base.js +11 -0
  68. package/dist/delivery/number-line/graph/elements/builder.d.ts +34 -0
  69. package/dist/delivery/number-line/graph/elements/builder.d.ts.map +1 -0
  70. package/dist/delivery/number-line/graph/elements/builder.js +30 -0
  71. package/dist/delivery/number-line/graph/elements/line.d.ts +52 -0
  72. package/dist/delivery/number-line/graph/elements/line.d.ts.map +1 -0
  73. package/dist/delivery/number-line/graph/elements/line.js +189 -0
  74. package/dist/delivery/number-line/graph/elements/point.d.ts +44 -0
  75. package/dist/delivery/number-line/graph/elements/point.d.ts.map +1 -0
  76. package/dist/delivery/number-line/graph/elements/point.js +127 -0
  77. package/dist/delivery/number-line/graph/elements/ray.d.ts +44 -0
  78. package/dist/delivery/number-line/graph/elements/ray.d.ts.map +1 -0
  79. package/dist/delivery/number-line/graph/elements/ray.js +130 -0
  80. package/dist/delivery/number-line/graph/index.d.ts +60 -0
  81. package/dist/delivery/number-line/graph/index.d.ts.map +1 -0
  82. package/dist/delivery/number-line/graph/index.js +196 -0
  83. package/dist/delivery/number-line/graph/line.d.ts +47 -0
  84. package/dist/delivery/number-line/graph/line.d.ts.map +1 -0
  85. package/dist/delivery/number-line/graph/line.js +27 -0
  86. package/dist/delivery/number-line/graph/stacks.d.ts +11 -0
  87. package/dist/delivery/number-line/graph/stacks.d.ts.map +1 -0
  88. package/dist/delivery/number-line/graph/stacks.js +40 -0
  89. package/dist/delivery/number-line/graph/tick-utils.d.ts +74 -0
  90. package/dist/delivery/number-line/graph/tick-utils.d.ts.map +1 -0
  91. package/dist/delivery/number-line/graph/tick-utils.js +297 -0
  92. package/dist/delivery/number-line/graph/ticks.d.ts +47 -0
  93. package/dist/delivery/number-line/graph/ticks.d.ts.map +1 -0
  94. package/dist/delivery/number-line/graph/ticks.js +115 -0
  95. package/dist/delivery/number-line/index.d.ts +36 -0
  96. package/dist/delivery/number-line/index.d.ts.map +1 -0
  97. package/dist/delivery/number-line/index.js +218 -0
  98. package/dist/delivery/number-line/point-chooser/button.d.ts +32 -0
  99. package/dist/delivery/number-line/point-chooser/button.d.ts.map +1 -0
  100. package/dist/delivery/number-line/point-chooser/button.js +36 -0
  101. package/dist/delivery/number-line/point-chooser/img.d.ts +11 -0
  102. package/dist/delivery/number-line/point-chooser/img.d.ts.map +1 -0
  103. package/dist/delivery/number-line/point-chooser/img.js +4 -0
  104. package/dist/delivery/number-line/point-chooser/index.d.ts +38 -0
  105. package/dist/delivery/number-line/point-chooser/index.d.ts.map +1 -0
  106. package/dist/delivery/number-line/point-chooser/index.js +154 -0
  107. package/dist/delivery/number-line/point-chooser/styles.d.ts +193 -0
  108. package/dist/delivery/number-line/point-chooser/styles.d.ts.map +1 -0
  109. package/dist/delivery/number-line/transitions/fade.d.ts +35 -0
  110. package/dist/delivery/number-line/transitions/fade.d.ts.map +1 -0
  111. package/dist/delivery/number-line/transitions/fade.js +75 -0
  112. package/dist/delivery/number-line/transitions/index.d.ts +11 -0
  113. package/dist/delivery/number-line/transitions/index.d.ts.map +1 -0
  114. package/dist/index.d.ts +2 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.iife.d.ts +9 -0
  117. package/dist/index.iife.d.ts.map +1 -0
  118. package/dist/index.iife.js +201 -0
  119. package/dist/index.js +2 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js +7 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js +8 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js +7 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseHasIn.js +6 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js +9 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMatch.js +26 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js +6 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIteratee.js +11 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatches.js +12 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +19 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js +13 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js +8 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js +9 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js +27 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js +15 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
  198. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js +19 -0
  199. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js +9 -0
  200. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  201. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  202. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  203. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  204. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  205. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  206. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  207. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  208. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMatchData.js +16 -0
  209. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  210. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  211. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  212. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  213. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  214. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  215. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  216. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hasPath.js +18 -0
  217. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  218. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  219. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  220. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  221. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  222. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  223. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  224. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  225. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  226. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  227. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
  228. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  229. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  230. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  231. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isStrictComparable.js +7 -0
  232. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  233. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  234. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  235. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  236. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  237. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  238. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  239. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  240. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  241. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  242. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  243. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
  244. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
  245. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  246. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  247. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  248. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  249. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  250. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  251. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  252. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  253. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js +6 -0
  254. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  255. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  256. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  257. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  258. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  259. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  260. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  261. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  262. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  263. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  264. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js +7 -0
  265. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
  266. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
  267. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  268. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  269. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  270. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  271. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  272. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/find.js +6 -0
  273. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js +13 -0
  274. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
  275. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js +8 -0
  276. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  277. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  278. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  279. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  280. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  281. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  282. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  283. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  284. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqualWith.js +9 -0
  285. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  286. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  287. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  288. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isNumber.js +9 -0
  289. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  290. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  291. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +14 -0
  292. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  293. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  294. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  295. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  296. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  297. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
  298. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +8 -0
  299. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/negate.js +17 -0
  300. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/noop.js +4 -0
  301. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/omitBy.js +9 -0
  302. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/pickBy.js +16 -0
  303. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/property.js +10 -0
  304. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  305. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  306. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js +8 -0
  307. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js +8 -0
  308. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
  309. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +8 -0
  310. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
  311. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniqWith.js +7 -0
  312. package/package.json +77 -0
  313. package/src/author/arrows.tsx +87 -0
  314. package/src/author/card-bar.tsx +70 -0
  315. package/src/author/defaults.ts +127 -0
  316. package/src/author/domain.tsx +79 -0
  317. package/src/author/index.ts +199 -0
  318. package/src/author/main.tsx +777 -0
  319. package/src/author/number-text-field.tsx +28 -0
  320. package/src/author/point-config.tsx +93 -0
  321. package/src/author/size.tsx +74 -0
  322. package/src/author/ticks.tsx +272 -0
  323. package/src/author/utils.ts +16 -0
  324. package/src/controller/defaults.ts +40 -0
  325. package/src/controller/index.ts +437 -0
  326. package/src/controller/tickUtils.ts +324 -0
  327. package/src/controller/utils.ts +159 -0
  328. package/src/delivery/data-converter.ts +88 -0
  329. package/src/delivery/draggable/index.ts +116 -0
  330. package/src/delivery/index.ts +225 -0
  331. package/src/delivery/number-line/colors.ts +15 -0
  332. package/src/delivery/number-line/feedback.tsx +85 -0
  333. package/src/delivery/number-line/graph/arrow.tsx +43 -0
  334. package/src/delivery/number-line/graph/elements/base.ts +20 -0
  335. package/src/delivery/number-line/graph/elements/builder.ts +37 -0
  336. package/src/delivery/number-line/graph/elements/line.tsx +259 -0
  337. package/src/delivery/number-line/graph/elements/point.tsx +219 -0
  338. package/src/delivery/number-line/graph/elements/ray.tsx +168 -0
  339. package/src/delivery/number-line/graph/index.tsx +258 -0
  340. package/src/delivery/number-line/graph/line.tsx +33 -0
  341. package/src/delivery/number-line/graph/stacks.ts +82 -0
  342. package/src/delivery/number-line/graph/tick-utils.ts +369 -0
  343. package/src/delivery/number-line/graph/ticks.tsx +189 -0
  344. package/src/delivery/number-line/index.tsx +385 -0
  345. package/src/delivery/number-line/point-chooser/button.tsx +54 -0
  346. package/src/delivery/number-line/point-chooser/img.ts +11 -0
  347. package/src/delivery/number-line/point-chooser/index.tsx +200 -0
  348. package/src/delivery/number-line/point-chooser/styles.ts +86 -0
  349. package/src/delivery/number-line/transitions/fade.tsx +100 -0
  350. package/src/delivery/number-line/transitions/index.ts +12 -0
  351. package/src/index.iife.ts +16 -0
  352. package/src/index.ts +1 -0
@@ -0,0 +1,324 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/number-line/controller/src/tickUtils.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 * as math from 'mathjs';
12
+ import { isNumber, isObject, uniqWith } from 'lodash-es';
13
+
14
+ // All these functions are duplicated in src/number-line/graph/tick-utils
15
+
16
+ /*This will store the possible decimal tick values*/
17
+ const decimalTickValues = [0.001, 0.01, 0.02, 0.04, 0.05, 0.1, 0.125, 0.2, 0.25, 0.5];
18
+
19
+ /*This will store the possible fraction tick values*/
20
+ const fractionTickValues = [
21
+ '1/1000',
22
+ '1/100',
23
+ '1/64',
24
+ '1/50',
25
+ '1/32',
26
+ '1/25',
27
+ '1/20',
28
+ '1/16',
29
+ '1/15',
30
+ '1/12',
31
+ '1/10',
32
+ '1/9',
33
+ '1/8',
34
+ '1/7',
35
+ '1/6',
36
+ '1/5',
37
+ '1/4',
38
+ '1/3',
39
+ '1/2',
40
+ ];
41
+
42
+ /*This const will store possible multiplier for label interval that needs to be multiplied
43
+ with tick interval with denominator represented with object key.*/
44
+ const labelMultiplier = {
45
+ 1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
46
+ 2: [1, 2, 4, 6, 8, 10],
47
+ 3: [1, 3, 6, 9],
48
+ 4: [1, 2, 4, 8],
49
+ 5: [1, 5, 10],
50
+ 6: [1, 2, 3, 6],
51
+ 7: [1, 7],
52
+ 8: [1, 2, 4, 8],
53
+ 9: [1, 3, 9],
54
+ 10: [1, 2, 5, 10],
55
+ 12: [1, 2, 3, 4, 6],
56
+ 15: [1, 3, 5],
57
+ 16: [1, 2, 4, 8],
58
+ 20: [1, 2, 4, 5, 10],
59
+ 25: [1, 5],
60
+ 32: [1, 2, 4, 8],
61
+ 50: [1, 2, 5, 10],
62
+ 64: [1, 2, 4, 8],
63
+ 100: [1, 2, 4, 5, 10],
64
+ 1000: [1, 2, 4, 5, 8, 10],
65
+ };
66
+
67
+ const fractionRange = (start, end, interval) => {
68
+ const m = math.mod(math.abs(start), math.abs(interval));
69
+ if (!math.equal(m, 0)) {
70
+ throw new Error('start point must be divisible by interval');
71
+ }
72
+
73
+ if (math.equal(start, end)) {
74
+ return [];
75
+ }
76
+
77
+ const e = math.subtract(end, math.mod(end, math.abs(interval)));
78
+
79
+ const direction = math.larger(interval, 0) ? 'positive' : 'negative';
80
+
81
+ if (direction === 'negative' && math.largerEq(end, start)) {
82
+ throw new Error('start must be > than end when doing a negative decrement');
83
+ }
84
+ if (direction === 'positive' && math.smallerEq(end, start)) {
85
+ throw new Error('start must be < end when doing increments');
86
+ }
87
+ const compareFn = direction === 'positive' ? math.smallerEq : math.equal(e, end) ? math.largerEq : math.larger;
88
+ const out = [];
89
+
90
+ let next = start;
91
+ while (compareFn(next, e)) {
92
+ out.push(next);
93
+ next = math.add(next, interval);
94
+ }
95
+ return out;
96
+ };
97
+
98
+ const zbrErrorMessage = (start, end) =>
99
+ `Can only do a positive or negative range, but got: start: ${start} and end:${end}`;
100
+
101
+ const zeroBasedRange = (start, end, interval) => {
102
+ start = math.fraction(start);
103
+ end = math.fraction(end);
104
+ interval = math.fraction(interval);
105
+
106
+ const length = math.abs(math.subtract(end, start));
107
+
108
+ if (math.larger(length, math.abs(end))) {
109
+ throw new Error(zbrErrorMessage(start, end));
110
+ }
111
+ const a = {
112
+ start: math.abs(start),
113
+ end: math.abs(end),
114
+ interval: math.abs(interval),
115
+ multiplier: math.smaller(interval, 0) ? -1 : 1,
116
+ };
117
+
118
+ const m = math.mod(a.start, a.interval);
119
+ const s = math.larger(m, 0) ? math.add(math.subtract(a.start, m), a.interval) : a.start;
120
+
121
+ const r = fractionRange(s, a.end, a.interval);
122
+ const out = a.multiplier === -1 ? r.map((v) => math.multiply(v, -1)) : r;
123
+
124
+ if (math.smaller(interval, 0)) {
125
+ out.reverse();
126
+ }
127
+ return out;
128
+ };
129
+
130
+ const fmin = (a, b) => {
131
+ a = math.fraction(a);
132
+ b = math.fraction(b);
133
+ return math.smaller(a, b) ? a : b;
134
+ };
135
+
136
+ const fmax = (a, b) => {
137
+ a = math.fraction(a);
138
+ b = math.fraction(b);
139
+ return math.larger(a, b) ? a : b;
140
+ };
141
+ /**
142
+ * the lodash range was causing too much variance in the rounding errors
143
+ * such that it was hard to round the numbers.
144
+ * This is a more simplistic version but makes rounding work.
145
+ */
146
+ const simpleRange = (start, end, interval) => {
147
+ start = math.fraction(start);
148
+ end = math.fraction(end);
149
+ interval = math.fraction(interval);
150
+
151
+ const positiveRange = math.larger(end, 0) ? zeroBasedRange(fmax(0, start), end, interval) : [];
152
+
153
+ const negativeRange = math.smaller(start, 0) ? zeroBasedRange(fmin(0, end), start, math.multiply(interval, -1)) : [];
154
+ let together = negativeRange.concat(positiveRange);
155
+
156
+ const out = uniqWith(together, math.equal);
157
+ return out;
158
+ };
159
+
160
+ const closeTo = (a, b, precision) => {
161
+ precision = precision || 2;
162
+ const expectedDiff = Math.pow(10, -precision) / 2;
163
+ const receivedDiff = Math.abs(a - b);
164
+ return receivedDiff < expectedDiff;
165
+ };
166
+
167
+ const limit = (v, min, max) => {
168
+ if (math.smaller(fraction(v), fraction(min))) {
169
+ return min;
170
+ }
171
+
172
+ if (math.larger(fraction(v), fraction(max))) {
173
+ return max;
174
+ }
175
+
176
+ return v;
177
+ };
178
+
179
+ /*
180
+ * Function to get tick interval limits based on min, max and width entered by the user.
181
+ * @param domain object containing max and min value.
182
+ * @param width number represents width of number line.
183
+ * */
184
+ export const getMinorLimits = (domain, width) => {
185
+ const end = domain.max - domain.min;
186
+ const min = math.number(math.multiply(10, math.divide(math.fraction(end), width)));
187
+ const max = math.number(math.multiply(20, min));
188
+ return {
189
+ min: min,
190
+ max: max,
191
+ };
192
+ };
193
+
194
+ const isMultiple = (multiple, src) => {
195
+ const mod = math.mod(multiple, src);
196
+ return math.equal(mod, 0);
197
+ };
198
+
199
+ /**
200
+ * Accepts a fraction object {n,d,s} or number.
201
+ * @param {*} v
202
+ * @return mathjs.fraction
203
+ */
204
+ const fraction = (v) => {
205
+ if (isObject(v)) {
206
+ return math.fraction(v.n * v.s, v.d);
207
+ } else if (isNumber(v)) {
208
+ return math.fraction(v);
209
+ }
210
+ };
211
+
212
+ const normalizeTicks = (domain, width, ticks, opts) => {
213
+ const useLimit = opts ? opts.limit !== false : true;
214
+ const minorLimits = getMinorLimits(domain, width);
215
+
216
+ const minor = useLimit ? limit(fraction(ticks.minor), minorLimits.min, minorLimits.max) : fraction(ticks.minor);
217
+ const major = useLimit ? limit(fraction(ticks.major), minor, math.multiply(minor, 20)) : fraction(ticks.major);
218
+
219
+ const isMajorMultiple = isMultiple(major, minor);
220
+
221
+ if (!isMajorMultiple) {
222
+ const multiplier = math.divide(major, minor);
223
+ const multiplyBy = multiplier <= 2 ? 2 : Math.round(multiplier);
224
+
225
+ // major must be a multiple of minor
226
+ return { minor, major: math.multiply(minor, multiplyBy) };
227
+ }
228
+
229
+ return { major, minor };
230
+ };
231
+
232
+ /**
233
+ * Build ticks as an array of mathjs Fractions
234
+ */
235
+ const buildTickDataAsFractions = (domain, width, ticks, opts) => {
236
+ ticks = normalizeTicks(domain, width, ticks, opts);
237
+ const rng = simpleRange(domain.min, domain.max, ticks.minor);
238
+
239
+ const o = rng
240
+ .filter((x) => math.smallerEq(x, math.fraction(domain.max)))
241
+ .map((x) => {
242
+ let type = 'minor';
243
+ const modulo = math.mod(x, ticks.major);
244
+
245
+ if (closeTo(math.number(modulo), 0)) {
246
+ type = 'major';
247
+ }
248
+
249
+ return { x, type };
250
+ });
251
+
252
+ return o;
253
+ };
254
+
255
+ /*
256
+ * This function will generate tick interval values based on min and max limits of ticks.
257
+ * @param minorLimits object containing min and max values
258
+ * @return out object containing three arrays 1. fraction values, 2. decimal values,
259
+ * */
260
+ export const generateMinorValues = (minorLimits) => {
261
+ let out = { fraction: [], decimal: [] };
262
+ decimalTickValues.forEach((value) => {
263
+ if (value >= minorLimits.min && value <= minorLimits.max) {
264
+ out.decimal.push(value);
265
+ }
266
+ });
267
+ fractionTickValues.forEach((value) => {
268
+ let decimalValue = math.number(math.fraction(value));
269
+ if (decimalValue >= minorLimits.min && decimalValue <= minorLimits.max) {
270
+ out.fraction.push(value);
271
+ }
272
+ });
273
+ return out;
274
+ };
275
+
276
+ /*
277
+ * This function will generate label interval values for provided tick interval value.
278
+ * @param minor number representing tick interval value.
279
+ * @param domain object containing min and max values.
280
+ * @param width number representing width of number line.
281
+ * @return out object containing three arrays 1. fraction values, 2. decimal values,
282
+ * */
283
+ export const generateMajorValuesForMinor = (minor, domain, width) => {
284
+ let out = { decimal: [], fraction: [] };
285
+ let fraction = math.fraction(math.number(math.number(minor)));
286
+ let n = fraction.n;
287
+ let d = fraction.d;
288
+ if (n >= 1 && d === 1) {
289
+ for (let i = 1; i <= 10; i++) {
290
+ let num = math.number(math.multiply(n, i));
291
+ //Here we check if this major value can plot at least 2 points on number line.
292
+ let ticksData = { minor: minor, major: num };
293
+ let output = buildTickData(domain, width, ticksData, { fraction: undefined });
294
+ if (output.filter((x) => x.type === 'major').length > 1) {
295
+ out.fraction.push(num.toString());
296
+ out.decimal.push(num);
297
+ }
298
+ }
299
+ } else {
300
+ for (const multiplierKey in labelMultiplier[d]) {
301
+ let num = math.multiply(math.fraction(n, d), labelMultiplier[d][multiplierKey]);
302
+ //Here we check if this major value can plot at least 2 points on number line.
303
+ let ticksData = { minor: minor, major: math.number(num) };
304
+ let output = buildTickData(domain, width, ticksData, { fraction: undefined });
305
+ if (output.filter((x) => x.type === 'major').length > 1) {
306
+ if (num.d !== 1) {
307
+ out.fraction.push(num.n + '/' + num.d);
308
+ } else {
309
+ out.fraction.push(num.n.toString());
310
+ }
311
+ out.decimal.push(math.number(num));
312
+ }
313
+ }
314
+ }
315
+ return out;
316
+ };
317
+
318
+ const buildTickData = (domain, width, ticks, opts) => {
319
+ const result = buildTickDataAsFractions(domain, width, ticks, opts);
320
+
321
+ const out = result.map((o) => (opts.fraction ? o : { ...o, x: math.number(o.x) || 0 }));
322
+
323
+ return out;
324
+ };
@@ -0,0 +1,159 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/number-line/controller/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 * as math from 'mathjs';
12
+ import { generateMajorValuesForMinor, generateMinorValues, getMinorLimits } from './tickUtils.js';
13
+
14
+ /*
15
+ * This function is duplicated in configure/main.js
16
+ * This function will update major value whenever minor value is changed or tick type is changed
17
+ * @param graph object containing domain, ticks and width value
18
+ * @return graph object with updated ticks values
19
+ * */
20
+ const updateMajorValue = (graph) => {
21
+ const { domain, ticks, width } = graph;
22
+ const majorValues = generateMajorValuesForMinor(ticks.minor, domain, width);
23
+ if (majorValues.decimal.indexOf(ticks.major) === -1) {
24
+ let currIndex = 0;
25
+ if (ticks.tickIntervalType === 'Integer') {
26
+ currIndex = majorValues.decimal.length > 4 ? 4 : majorValues.decimal.length - 1;
27
+ } else {
28
+ currIndex = majorValues.decimal.length - 1;
29
+ }
30
+ ticks.major = majorValues.decimal[currIndex];
31
+ }
32
+ graph.fraction = ticks.tickIntervalType === 'Fraction' && ticks.major < 1;
33
+ return { ...graph, ticks };
34
+ };
35
+
36
+ /*
37
+ * This function is duplicated in configure/main.js
38
+ * This function will reload ticks data whenever graph object is changed and also sets required tick object
39
+ * for rendering Ticks Components.
40
+ * @param graph object containing domain, ticks and width value
41
+ * @return graph object with updated ticks values
42
+ * */
43
+
44
+ export const reloadTicksData = (graph) => {
45
+ const { domain, ticks = {}, width } = graph;
46
+ //Set tick interval type if not present for legacy number line models depending upon minor value
47
+ if (!ticks.tickIntervalType) {
48
+ if (ticks.minor > 0.5) {
49
+ ticks.tickIntervalType = 'Integer';
50
+ } else {
51
+ ticks.tickIntervalType = 'Decimal';
52
+ }
53
+ }
54
+ // This section will calculate minor and major values array and assign respective value
55
+ // to different tick types object
56
+ const minorLimits = getMinorLimits(domain, width);
57
+ if (minorLimits.min >= 1) {
58
+ /*
59
+ * In this scenario only integer tick will be enabled
60
+ * */
61
+ ticks.tickIntervalType = 'Integer';
62
+ ticks.minor =
63
+ ticks.minor < 1
64
+ ? math.number(math.ceil(minorLimits.min))
65
+ : ticks.minor >= math.number(math.ceil(minorLimits.min)) &&
66
+ ticks.minor <= math.number(math.floor(minorLimits.max))
67
+ ? ticks.minor
68
+ : math.number(math.ceil(minorLimits.min));
69
+ ticks.integerTick = ticks.minor;
70
+ const minorValues = { decimal: [], fraction: [] };
71
+ ticks.fractionTick = '0';
72
+ ticks.decimalTick = 0;
73
+ } else if (minorLimits.min >= 0 && minorLimits.max < 1) {
74
+ /*
75
+ * In this scenario only decimal or fraction tick will be enabled
76
+ * */
77
+ if (ticks.tickIntervalType === 'Integer') {
78
+ ticks.tickIntervalType = 'Fraction';
79
+ }
80
+ const minorValues = generateMinorValues(minorLimits);
81
+ let minValue = math.number(math.fraction(minorValues.fraction[0]));
82
+ let maxValue = math.number(math.fraction(minorValues.fraction[minorValues.fraction.length - 1]));
83
+ if (ticks.minor < minValue || ticks.minor > maxValue) {
84
+ switch (ticks.tickIntervalType) {
85
+ case 'Fraction':
86
+ ticks.minor = math.number(math.fraction(minorValues.fraction[minorValues.fraction.length - 1]));
87
+ ticks.fractionTick = minorValues.fraction[minorValues.fraction.length - 1];
88
+ ticks.decimalTick = minorValues.decimal[0];
89
+ break;
90
+ case 'Decimal':
91
+ case 'Integer':
92
+ ticks.minor = minorValues.decimal[minorValues.decimal.length - 1];
93
+ ticks.decimalTick = minorValues.decimal[minorValues.decimal.length - 1];
94
+ ticks.fractionTick = minorValues.fraction[0];
95
+ }
96
+ } else {
97
+ switch (ticks.tickIntervalType) {
98
+ case 'Fraction':
99
+ let fraction = math.fraction(math.number(ticks.minor));
100
+ ticks.fractionTick = fraction.n + '/' + fraction.d;
101
+ ticks.decimalTick = ticks.decimalTick ? ticks.decimalTick : minorValues.decimal[0];
102
+ break;
103
+ case 'Decimal':
104
+ case 'Integer':
105
+ ticks.decimalTick = ticks.minor;
106
+ ticks.fractionTick = ticks.fractionTick ? ticks.fractionTick : minorValues.fraction[0];
107
+ }
108
+ }
109
+ ticks.integerTick = 1;
110
+ } else if (minorLimits.min < 1 && minorLimits.max >= 1) {
111
+ /*
112
+ * In this scenario all integer, decimal or fraction tick will be enabled
113
+ * */
114
+ const minorValues = generateMinorValues(minorLimits);
115
+ if (!(ticks.minor >= minorLimits.min && ticks.minor <= minorLimits.max)) {
116
+ if (minorLimits.min > 0.5) {
117
+ ticks.tickIntervalType = 'Integer';
118
+ }
119
+ switch (ticks.tickIntervalType) {
120
+ case 'Integer':
121
+ ticks.minor = math.number(math.ceil(minorLimits.min));
122
+ ticks.integerTick = ticks.minor;
123
+ ticks.decimalTick = minorLimits.min > 0.5 ? 0 : minorValues.decimal[0];
124
+ ticks.fractionTick = minorLimits.min > 0.5 ? '0' : minorValues.fraction[0];
125
+ break;
126
+ case 'Decimal':
127
+ ticks.minor = minorValues.decimal[0];
128
+ ticks.integerTick = 1;
129
+ ticks.decimalTick = ticks.minor;
130
+ ticks.fractionTick = minorValues.fraction[0];
131
+ break;
132
+ case 'Fraction':
133
+ ticks.minor = math.number(math.fraction(minorValues.fraction[0]));
134
+ ticks.integerTick = 1;
135
+ ticks.decimalTick = minorValues.decimal[0];
136
+ ticks.fractionTick = minorValues.fraction[0];
137
+ }
138
+ } else {
139
+ switch (ticks.tickIntervalType) {
140
+ case 'Integer':
141
+ ticks.integerTick = ticks.minor;
142
+ ticks.decimalTick = minorLimits.min > 0.5 ? 0 : minorValues.decimal[0];
143
+ ticks.fractionTick = minorLimits.min > 0.5 ? '0' : minorValues.fraction[0];
144
+ break;
145
+ case 'Decimal':
146
+ ticks.integerTick = 1;
147
+ ticks.decimalTick = ticks.minor;
148
+ ticks.fractionTick = minorValues.fraction[0];
149
+ break;
150
+ case 'Fraction':
151
+ ticks.integerTick = 1;
152
+ ticks.decimalTick = minorValues.decimal[0];
153
+ let fraction = math.fraction(math.number(ticks.minor));
154
+ ticks.fractionTick = fraction.n + '/' + fraction.d;
155
+ }
156
+ }
157
+ }
158
+ return updateMajorValue({ ...graph, ticks });
159
+ };
@@ -0,0 +1,88 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/number-line/src/data-converter.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
+ export const lineIsSwitched = (line) => {
12
+ let { position } = line;
13
+ return position.left > position.right;
14
+ };
15
+
16
+ export const switchGraphLine = (line) => {
17
+ let { position } = line;
18
+
19
+ if (position.left < position.right) {
20
+ return line;
21
+ }
22
+
23
+ let { leftPoint: newRightPoint, rightPoint: newLeftPoint } = line;
24
+
25
+ return {
26
+ leftPoint: newLeftPoint,
27
+ rightPoint: newRightPoint,
28
+ position: switchPosition(position),
29
+ type: 'line',
30
+ };
31
+ };
32
+
33
+ export const switchPosition = (p) => {
34
+ let { left: newRight, right: newLeft } = p;
35
+ return { left: newLeft, right: newRight };
36
+ };
37
+
38
+ export const toSessionFormat = (gf) => {
39
+ if (gf.type === 'point') {
40
+ return {
41
+ type: 'point',
42
+ pointType: gf.pointType,
43
+ domainPosition: gf.position,
44
+ };
45
+ } else if (gf.type === 'line') {
46
+ return {
47
+ type: 'line',
48
+ size: gf.position.right - gf.position.left,
49
+ domainPosition: gf.position.left,
50
+ leftPoint: gf.leftPoint,
51
+ rightPoint: gf.rightPoint,
52
+ };
53
+ } else if (gf.type === 'ray') {
54
+ return {
55
+ type: 'ray',
56
+ domainPosition: gf.position,
57
+ pointType: gf.pointType,
58
+ direction: gf.direction,
59
+ };
60
+ }
61
+ };
62
+
63
+ export const toGraphFormat = (sf) => {
64
+ if (sf.type === 'point') {
65
+ return {
66
+ type: 'point',
67
+ pointType: sf.pointType,
68
+ position: sf.domainPosition,
69
+ };
70
+ } else if (sf.type === 'line') {
71
+ return {
72
+ type: 'line',
73
+ position: {
74
+ left: sf.domainPosition,
75
+ right: sf.domainPosition + sf.size,
76
+ },
77
+ leftPoint: sf.leftPoint,
78
+ rightPoint: sf.rightPoint,
79
+ };
80
+ } else if (sf.type === 'ray') {
81
+ return {
82
+ type: 'ray',
83
+ position: sf.domainPosition,
84
+ pointType: sf.pointType,
85
+ direction: sf.direction,
86
+ };
87
+ }
88
+ };
@@ -0,0 +1,116 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/number-line/src/draggable/index.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ // Draggable.jsx
12
+ import React from 'react';
13
+ import { useDraggable, useDndMonitor } from '@dnd-kit/core';
14
+
15
+ /**
16
+ * Shared dnd-kit wrapper for Line + Point.
17
+ *
18
+ * Props:
19
+ * - id: string (unique)
20
+ * - disabled: boolean
21
+ * - grid: [stepX] (like grid={[is]})
22
+ * - bounds: { left: number, right: number } in px (like scaledLineBounds)
23
+ * - onMouseDown: (event) => void
24
+ * - onDragStart?: () => void
25
+ * - onDragMove?: (deltaX: number) => void // snapped + clamped
26
+ * - onDragEnd?: (deltaX: number) => void // snapped + clamped
27
+ * - children: ({ setNodeRef, attributes, listeners, translateX, isDragging, onMouseDown }) => ReactNode
28
+ */
29
+ export function Draggable({
30
+ id,
31
+ disabled,
32
+ grid,
33
+ bounds,
34
+ onMouseDown,
35
+ onDragStart,
36
+ onDragMove,
37
+ onDragEnd,
38
+ children,
39
+ }) {
40
+ const { attributes, listeners, setNodeRef, transform } = useDraggable({
41
+ id,
42
+ disabled,
43
+ });
44
+
45
+ const step = grid && grid[0] ? grid[0] : null;
46
+
47
+ // current transform.x from dnd-kit
48
+ let rawX = transform?.x ?? 0;
49
+
50
+ // grid snapping (grid={[step]})
51
+ if (step) {
52
+ rawX = Math.round(rawX / step) * step;
53
+ }
54
+
55
+ // clamp to bounds in px
56
+ if (bounds) {
57
+ if (typeof bounds.left === 'number') {
58
+ rawX = Math.max(bounds.left, rawX);
59
+ }
60
+ if (typeof bounds.right === 'number') {
61
+ rawX = Math.min(bounds.right, rawX);
62
+ }
63
+ }
64
+
65
+ const translateX = rawX;
66
+ const isDragging = !!transform;
67
+
68
+ // helpers to apply same snap+clamp to deltaX before callbacks
69
+ const snapClampDeltaX = (deltaX) => {
70
+ let x = deltaX;
71
+ if (step) {
72
+ x = Math.round(x / step) * step;
73
+ }
74
+ if (bounds) {
75
+ if (typeof bounds.left === 'number') {
76
+ x = Math.max(bounds.left, x);
77
+ }
78
+ if (typeof bounds.right === 'number') {
79
+ x = Math.min(bounds.right, x);
80
+ }
81
+ }
82
+ return x;
83
+ };
84
+
85
+ useDndMonitor({
86
+ onDragStart(event) {
87
+ if (event.active.id !== id || disabled) return;
88
+ onDragStart?.();
89
+ },
90
+ onDragMove(event) {
91
+ if (event.active.id !== id || disabled) return;
92
+ const deltaX = event.delta.x || 0;
93
+ onDragMove?.(snapClampDeltaX(deltaX));
94
+ },
95
+ onDragEnd(event) {
96
+ if (event.active.id !== id || disabled) return;
97
+ const deltaX = event.delta.x || 0;
98
+ onDragEnd?.(snapClampDeltaX(deltaX));
99
+ },
100
+ });
101
+
102
+ const handleMouseDown = (e) => {
103
+ // same as before: prevent text selection
104
+ e.nativeEvent.preventDefault();
105
+ onMouseDown?.(e);
106
+ };
107
+
108
+ return children({
109
+ setNodeRef,
110
+ attributes,
111
+ listeners,
112
+ translateX,
113
+ isDragging,
114
+ onMouseDown: handleMouseDown,
115
+ });
116
+ }