@wandelbots/wandelbots-js-react-components 5.4.2 → 5.5.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 (668) hide show
  1. package/dist/3d.cjs +2 -0
  2. package/dist/3d.cjs.map +1 -0
  3. package/dist/3d.js +31 -0
  4. package/dist/3d.js.map +1 -0
  5. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -0
  6. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
  7. package/dist/components/3d-viewport/PresetEnvironment.cjs +2 -0
  8. package/dist/components/3d-viewport/PresetEnvironment.cjs.map +1 -0
  9. package/dist/components/3d-viewport/PresetEnvironment.d.ts +1 -0
  10. package/dist/components/3d-viewport/PresetEnvironment.d.ts.map +1 -1
  11. package/dist/components/3d-viewport/PresetEnvironment.js +81 -0
  12. package/dist/components/3d-viewport/PresetEnvironment.js.map +1 -0
  13. package/dist/components/3d-viewport/SafetyZonesRenderer.cjs +2 -0
  14. package/dist/components/3d-viewport/SafetyZonesRenderer.cjs.map +1 -0
  15. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +1 -0
  16. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
  17. package/dist/components/3d-viewport/SafetyZonesRenderer.js +131 -0
  18. package/dist/components/3d-viewport/SafetyZonesRenderer.js.map +1 -0
  19. package/dist/components/3d-viewport/TrajectoryRenderer.cjs +2 -0
  20. package/dist/components/3d-viewport/TrajectoryRenderer.cjs.map +1 -0
  21. package/dist/components/3d-viewport/TrajectoryRenderer.d.ts +1 -0
  22. package/dist/components/3d-viewport/TrajectoryRenderer.d.ts.map +1 -1
  23. package/dist/components/3d-viewport/TrajectoryRenderer.js +31 -0
  24. package/dist/components/3d-viewport/TrajectoryRenderer.js.map +1 -0
  25. package/dist/components/3d-viewport/collider/ColliderCollection.cjs +2 -0
  26. package/dist/components/3d-viewport/collider/ColliderCollection.cjs.map +1 -0
  27. package/dist/components/3d-viewport/collider/ColliderCollection.js +22 -0
  28. package/dist/components/3d-viewport/collider/ColliderCollection.js.map +1 -0
  29. package/dist/components/3d-viewport/collider/ColliderElement.cjs +2 -0
  30. package/dist/components/3d-viewport/collider/ColliderElement.cjs.map +1 -0
  31. package/dist/components/3d-viewport/collider/ColliderElement.js +29 -0
  32. package/dist/components/3d-viewport/collider/ColliderElement.js.map +1 -0
  33. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.cjs +2 -0
  34. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.cjs.map +1 -0
  35. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.js +19 -0
  36. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.js.map +1 -0
  37. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.cjs +2 -0
  38. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.cjs.map +1 -0
  39. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.js +43 -0
  40. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.js.map +1 -0
  41. package/dist/components/AppHeader.cjs +2 -0
  42. package/dist/components/AppHeader.cjs.map +1 -0
  43. package/dist/components/AppHeader.d.ts +1 -0
  44. package/dist/components/AppHeader.d.ts.map +1 -1
  45. package/dist/components/AppHeader.js +139 -0
  46. package/dist/components/AppHeader.js.map +1 -0
  47. package/dist/components/ConsoleFilter.cjs +2 -0
  48. package/dist/components/ConsoleFilter.cjs.map +1 -0
  49. package/dist/components/ConsoleFilter.js +13 -0
  50. package/dist/components/ConsoleFilter.js.map +1 -0
  51. package/dist/components/CopyableText.cjs +2 -0
  52. package/dist/components/CopyableText.cjs.map +1 -0
  53. package/dist/components/CopyableText.d.ts +1 -0
  54. package/dist/components/CopyableText.d.ts.map +1 -1
  55. package/dist/components/CopyableText.js +71 -0
  56. package/dist/components/CopyableText.js.map +1 -0
  57. package/dist/components/CycleTimer/CycleTimer.d.ts +1 -0
  58. package/dist/components/CycleTimer/CycleTimer.d.ts.map +1 -1
  59. package/dist/components/CycleTimer/DefaultVariant.cjs +2 -0
  60. package/dist/components/CycleTimer/DefaultVariant.cjs.map +1 -0
  61. package/dist/components/CycleTimer/DefaultVariant.js +301 -0
  62. package/dist/components/CycleTimer/DefaultVariant.js.map +1 -0
  63. package/dist/components/CycleTimer/SmallVariant.cjs +2 -0
  64. package/dist/components/CycleTimer/SmallVariant.cjs.map +1 -0
  65. package/dist/components/CycleTimer/SmallVariant.js +150 -0
  66. package/dist/components/CycleTimer/SmallVariant.js.map +1 -0
  67. package/dist/components/CycleTimer/index.cjs +2 -0
  68. package/dist/components/CycleTimer/index.cjs.map +1 -0
  69. package/dist/components/CycleTimer/index.d.ts +1 -0
  70. package/dist/components/CycleTimer/index.d.ts.map +1 -1
  71. package/dist/components/CycleTimer/index.js +86 -0
  72. package/dist/components/CycleTimer/index.js.map +1 -0
  73. package/dist/components/CycleTimer/useAnimations.cjs +2 -0
  74. package/dist/components/CycleTimer/useAnimations.cjs.map +1 -0
  75. package/dist/components/CycleTimer/useAnimations.js +105 -0
  76. package/dist/components/CycleTimer/useAnimations.js.map +1 -0
  77. package/dist/components/CycleTimer/useTimerLogic.cjs +2 -0
  78. package/dist/components/CycleTimer/useTimerLogic.cjs.map +1 -0
  79. package/dist/components/CycleTimer/useTimerLogic.js +191 -0
  80. package/dist/components/CycleTimer/useTimerLogic.js.map +1 -0
  81. package/dist/components/CycleTimer/utils.cjs +2 -0
  82. package/dist/components/CycleTimer/utils.cjs.map +1 -0
  83. package/dist/components/CycleTimer/utils.js +20 -0
  84. package/dist/components/CycleTimer/utils.js.map +1 -0
  85. package/dist/components/CycleTimer.cjs +2 -0
  86. package/dist/components/CycleTimer.cjs.map +1 -0
  87. package/dist/components/CycleTimer.d.ts +1 -0
  88. package/dist/components/CycleTimer.d.ts.map +1 -1
  89. package/dist/components/CycleTimer.js +6 -0
  90. package/dist/components/CycleTimer.js.map +1 -0
  91. package/dist/components/DataGrid.cjs +2 -0
  92. package/dist/components/DataGrid.cjs.map +1 -0
  93. package/dist/components/DataGrid.d.ts +1 -0
  94. package/dist/components/DataGrid.d.ts.map +1 -1
  95. package/dist/components/DataGrid.js +535 -0
  96. package/dist/components/DataGrid.js.map +1 -0
  97. package/dist/components/LoadingCover.cjs +2 -0
  98. package/dist/components/LoadingCover.cjs.map +1 -0
  99. package/dist/components/LoadingCover.d.ts +1 -0
  100. package/dist/components/LoadingCover.d.ts.map +1 -1
  101. package/dist/components/LoadingCover.js +77 -0
  102. package/dist/components/LoadingCover.js.map +1 -0
  103. package/dist/components/LogPanel.cjs +2 -0
  104. package/dist/components/LogPanel.cjs.map +1 -0
  105. package/dist/components/LogPanel.d.ts +1 -0
  106. package/dist/components/LogPanel.d.ts.map +1 -1
  107. package/dist/components/LogPanel.js +34 -0
  108. package/dist/components/LogPanel.js.map +1 -0
  109. package/dist/components/LogStore.cjs +2 -0
  110. package/dist/components/LogStore.cjs.map +1 -0
  111. package/dist/components/LogStore.d.ts +1 -0
  112. package/dist/components/LogStore.d.ts.map +1 -1
  113. package/dist/components/LogStore.js +33 -0
  114. package/dist/components/LogStore.js.map +1 -0
  115. package/dist/components/LogViewer.cjs +2 -0
  116. package/dist/components/LogViewer.cjs.map +1 -0
  117. package/dist/components/LogViewer.d.ts +1 -0
  118. package/dist/components/LogViewer.d.ts.map +1 -1
  119. package/dist/components/LogViewer.js +299 -0
  120. package/dist/components/LogViewer.js.map +1 -0
  121. package/dist/components/ProgramControl.cjs +2 -0
  122. package/dist/components/ProgramControl.cjs.map +1 -0
  123. package/dist/components/ProgramControl.d.ts +1 -0
  124. package/dist/components/ProgramControl.d.ts.map +1 -1
  125. package/dist/components/ProgramControl.js +147 -0
  126. package/dist/components/ProgramControl.js.map +1 -0
  127. package/dist/components/ProgramStateIndicator.cjs +2 -0
  128. package/dist/components/ProgramStateIndicator.cjs.map +1 -0
  129. package/dist/components/ProgramStateIndicator.d.ts +1 -0
  130. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  131. package/dist/components/ProgramStateIndicator.js +140 -0
  132. package/dist/components/ProgramStateIndicator.js.map +1 -0
  133. package/dist/components/RobotCard.cjs +2 -0
  134. package/dist/components/RobotCard.cjs.map +1 -0
  135. package/dist/components/RobotCard.d.ts +1 -0
  136. package/dist/components/RobotCard.d.ts.map +1 -1
  137. package/dist/components/RobotCard.js +360 -0
  138. package/dist/components/RobotCard.js.map +1 -0
  139. package/dist/components/RobotListItem.cjs +2 -0
  140. package/dist/components/RobotListItem.cjs.map +1 -0
  141. package/dist/components/RobotListItem.d.ts +1 -0
  142. package/dist/components/RobotListItem.d.ts.map +1 -1
  143. package/dist/components/RobotListItem.js +122 -0
  144. package/dist/components/RobotListItem.js.map +1 -0
  145. package/dist/components/RobotSetupReadinessIndicator.cjs +2 -0
  146. package/dist/components/RobotSetupReadinessIndicator.cjs.map +1 -0
  147. package/dist/components/RobotSetupReadinessIndicator.d.ts +1 -0
  148. package/dist/components/RobotSetupReadinessIndicator.d.ts.map +1 -1
  149. package/dist/components/RobotSetupReadinessIndicator.js +122 -0
  150. package/dist/components/RobotSetupReadinessIndicator.js.map +1 -0
  151. package/dist/components/SelectableFab.cjs +2 -0
  152. package/dist/components/SelectableFab.cjs.map +1 -0
  153. package/dist/components/SelectableFab.d.ts +1 -1
  154. package/dist/components/SelectableFab.d.ts.map +1 -1
  155. package/dist/components/SelectableFab.js +51 -0
  156. package/dist/components/SelectableFab.js.map +1 -0
  157. package/dist/components/TabBar.cjs +2 -0
  158. package/dist/components/TabBar.cjs.map +1 -0
  159. package/dist/components/TabBar.d.ts +1 -0
  160. package/dist/components/TabBar.d.ts.map +1 -1
  161. package/dist/components/TabBar.js +212 -0
  162. package/dist/components/TabBar.js.map +1 -0
  163. package/dist/components/ThemeSelect.d.ts +1 -1
  164. package/dist/components/ThemeSelect.d.ts.map +1 -1
  165. package/dist/components/Timer/Timer.d.ts +1 -0
  166. package/dist/components/Timer/Timer.d.ts.map +1 -1
  167. package/dist/components/Timer/TimerDefaultVariant.cjs +2 -0
  168. package/dist/components/Timer/TimerDefaultVariant.cjs.map +1 -0
  169. package/dist/components/Timer/TimerDefaultVariant.js +136 -0
  170. package/dist/components/Timer/TimerDefaultVariant.js.map +1 -0
  171. package/dist/components/Timer/TimerSmallVariant.cjs +2 -0
  172. package/dist/components/Timer/TimerSmallVariant.cjs.map +1 -0
  173. package/dist/components/Timer/TimerSmallVariant.js +128 -0
  174. package/dist/components/Timer/TimerSmallVariant.js.map +1 -0
  175. package/dist/components/Timer/index.cjs +2 -0
  176. package/dist/components/Timer/index.cjs.map +1 -0
  177. package/dist/components/Timer/index.d.ts +1 -0
  178. package/dist/components/Timer/index.d.ts.map +1 -1
  179. package/dist/components/Timer/index.js +68 -0
  180. package/dist/components/Timer/index.js.map +1 -0
  181. package/dist/components/Timer/useTimerAnimations.cjs +2 -0
  182. package/dist/components/Timer/useTimerAnimations.cjs.map +1 -0
  183. package/dist/components/Timer/useTimerAnimations.js +48 -0
  184. package/dist/components/Timer/useTimerAnimations.js.map +1 -0
  185. package/dist/components/Timer/useTimerLogic.cjs +2 -0
  186. package/dist/components/Timer/useTimerLogic.cjs.map +1 -0
  187. package/dist/components/Timer/useTimerLogic.js +113 -0
  188. package/dist/components/Timer/useTimerLogic.js.map +1 -0
  189. package/dist/components/Timer/utils.cjs +2 -0
  190. package/dist/components/Timer/utils.cjs.map +1 -0
  191. package/dist/components/Timer/utils.js +19 -0
  192. package/dist/components/Timer/utils.js.map +1 -0
  193. package/dist/components/Timer.cjs +2 -0
  194. package/dist/components/Timer.cjs.map +1 -0
  195. package/dist/components/Timer.d.ts +4 -0
  196. package/dist/components/Timer.d.ts.map +1 -0
  197. package/dist/components/Timer.js +6 -0
  198. package/dist/components/Timer.js.map +1 -0
  199. package/dist/components/TransparentOverlay.d.ts +1 -0
  200. package/dist/components/TransparentOverlay.d.ts.map +1 -1
  201. package/dist/components/VelocitySlider.cjs +2 -0
  202. package/dist/components/VelocitySlider.cjs.map +1 -0
  203. package/dist/components/VelocitySlider.d.ts +1 -1
  204. package/dist/components/VelocitySlider.d.ts.map +1 -1
  205. package/dist/components/VelocitySlider.js +97 -0
  206. package/dist/components/VelocitySlider.js.map +1 -0
  207. package/dist/components/experimental/utils/AdornedSelect.cjs +2 -0
  208. package/dist/components/experimental/utils/AdornedSelect.cjs.map +1 -0
  209. package/dist/components/experimental/utils/AdornedSelect.js +35 -0
  210. package/dist/components/experimental/utils/AdornedSelect.js.map +1 -0
  211. package/dist/components/jogging/JoggingBlocked.cjs +2 -0
  212. package/dist/components/jogging/JoggingBlocked.cjs.map +1 -0
  213. package/dist/components/jogging/JoggingBlocked.js +46 -0
  214. package/dist/components/jogging/JoggingBlocked.js.map +1 -0
  215. package/dist/components/jogging/JoggingCartesianAxisControl.cjs +2 -0
  216. package/dist/components/jogging/JoggingCartesianAxisControl.cjs.map +1 -0
  217. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +1 -1
  218. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts.map +1 -1
  219. package/dist/components/jogging/JoggingCartesianAxisControl.js +186 -0
  220. package/dist/components/jogging/JoggingCartesianAxisControl.js.map +1 -0
  221. package/dist/components/jogging/JoggingCartesianTab.cjs +2 -0
  222. package/dist/components/jogging/JoggingCartesianTab.cjs.map +1 -0
  223. package/dist/components/jogging/JoggingCartesianTab.js +267 -0
  224. package/dist/components/jogging/JoggingCartesianTab.js.map +1 -0
  225. package/dist/components/jogging/JoggingJointLimitDetector.cjs +2 -0
  226. package/dist/components/jogging/JoggingJointLimitDetector.cjs.map +1 -0
  227. package/dist/components/jogging/JoggingJointLimitDetector.js +42 -0
  228. package/dist/components/jogging/JoggingJointLimitDetector.js.map +1 -0
  229. package/dist/components/jogging/JoggingJointTab.cjs +2 -0
  230. package/dist/components/jogging/JoggingJointTab.cjs.map +1 -0
  231. package/dist/components/jogging/JoggingJointTab.js +114 -0
  232. package/dist/components/jogging/JoggingJointTab.js.map +1 -0
  233. package/dist/components/jogging/JoggingJointValueControl.cjs +2 -0
  234. package/dist/components/jogging/JoggingJointValueControl.cjs.map +1 -0
  235. package/dist/components/jogging/JoggingJointValueControl.d.ts +1 -1
  236. package/dist/components/jogging/JoggingJointValueControl.d.ts.map +1 -1
  237. package/dist/components/jogging/JoggingJointValueControl.js +240 -0
  238. package/dist/components/jogging/JoggingJointValueControl.js.map +1 -0
  239. package/dist/components/jogging/JoggingOptions.cjs +2 -0
  240. package/dist/components/jogging/JoggingOptions.cjs.map +1 -0
  241. package/dist/components/jogging/JoggingOptions.js +117 -0
  242. package/dist/components/jogging/JoggingOptions.js.map +1 -0
  243. package/dist/components/jogging/JoggingPanel.cjs +2 -0
  244. package/dist/components/jogging/JoggingPanel.cjs.map +1 -0
  245. package/dist/components/jogging/JoggingPanel.d.ts +1 -0
  246. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  247. package/dist/components/jogging/JoggingPanel.js +121 -0
  248. package/dist/components/jogging/JoggingPanel.js.map +1 -0
  249. package/dist/components/jogging/JoggingStore.cjs +2 -0
  250. package/dist/components/jogging/JoggingStore.cjs.map +1 -0
  251. package/dist/components/jogging/JoggingStore.d.ts +1 -1
  252. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  253. package/dist/components/jogging/JoggingStore.js +219 -0
  254. package/dist/components/jogging/JoggingStore.js.map +1 -0
  255. package/dist/components/jogging/JoggingToggleButtonGroup.cjs +2 -0
  256. package/dist/components/jogging/JoggingToggleButtonGroup.cjs.map +1 -0
  257. package/dist/components/jogging/JoggingToggleButtonGroup.js +29 -0
  258. package/dist/components/jogging/JoggingToggleButtonGroup.js.map +1 -0
  259. package/dist/components/jogging/JoggingVelocitySlider.cjs +2 -0
  260. package/dist/components/jogging/JoggingVelocitySlider.cjs.map +1 -0
  261. package/dist/components/jogging/JoggingVelocitySlider.js +40 -0
  262. package/dist/components/jogging/JoggingVelocitySlider.js.map +1 -0
  263. package/dist/components/jogging/PoseCartesianValues.cjs +2 -0
  264. package/dist/components/jogging/PoseCartesianValues.cjs.map +1 -0
  265. package/dist/components/jogging/PoseCartesianValues.d.ts +1 -0
  266. package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
  267. package/dist/components/jogging/PoseCartesianValues.js +48 -0
  268. package/dist/components/jogging/PoseCartesianValues.js.map +1 -0
  269. package/dist/components/jogging/PoseJointValues.cjs +2 -0
  270. package/dist/components/jogging/PoseJointValues.cjs.map +1 -0
  271. package/dist/components/jogging/PoseJointValues.d.ts +1 -0
  272. package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
  273. package/dist/components/jogging/PoseJointValues.js +47 -0
  274. package/dist/components/jogging/PoseJointValues.js.map +1 -0
  275. package/dist/components/modal/NoMotionGroupModal.cjs +2 -0
  276. package/dist/components/modal/NoMotionGroupModal.cjs.map +1 -0
  277. package/dist/components/modal/NoMotionGroupModal.d.ts +1 -0
  278. package/dist/components/modal/NoMotionGroupModal.d.ts.map +1 -1
  279. package/dist/components/modal/NoMotionGroupModal.js +92 -0
  280. package/dist/components/modal/NoMotionGroupModal.js.map +1 -0
  281. package/dist/components/robots/AxisConfig.cjs +2 -0
  282. package/dist/components/robots/AxisConfig.cjs.map +1 -0
  283. package/dist/components/robots/AxisConfig.js +5 -0
  284. package/dist/components/robots/AxisConfig.js.map +1 -0
  285. package/dist/components/robots/DHLinearAxis.cjs +2 -0
  286. package/dist/components/robots/DHLinearAxis.cjs.map +1 -0
  287. package/dist/components/robots/DHLinearAxis.d.ts +1 -0
  288. package/dist/components/robots/DHLinearAxis.d.ts.map +1 -1
  289. package/dist/components/robots/DHLinearAxis.js +92 -0
  290. package/dist/components/robots/DHLinearAxis.js.map +1 -0
  291. package/dist/components/robots/DHRobot.cjs +2 -0
  292. package/dist/components/robots/DHRobot.cjs.map +1 -0
  293. package/dist/components/robots/DHRobot.d.ts +1 -0
  294. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  295. package/dist/components/robots/DHRobot.js +94 -0
  296. package/dist/components/robots/DHRobot.js.map +1 -0
  297. package/dist/components/robots/GenericRobot.cjs +2 -0
  298. package/dist/components/robots/GenericRobot.cjs.map +1 -0
  299. package/dist/components/robots/GenericRobot.d.ts +1 -0
  300. package/dist/components/robots/GenericRobot.d.ts.map +1 -1
  301. package/dist/components/robots/GenericRobot.js +91 -0
  302. package/dist/components/robots/GenericRobot.js.map +1 -0
  303. package/dist/components/robots/LinearAxis.cjs +2 -0
  304. package/dist/components/robots/LinearAxis.cjs.map +1 -0
  305. package/dist/components/robots/LinearAxis.d.ts +1 -0
  306. package/dist/components/robots/LinearAxis.d.ts.map +1 -1
  307. package/dist/components/robots/LinearAxis.js +42 -0
  308. package/dist/components/robots/LinearAxis.js.map +1 -0
  309. package/dist/components/robots/LinearAxisAnimator.cjs +2 -0
  310. package/dist/components/robots/LinearAxisAnimator.cjs.map +1 -0
  311. package/dist/components/robots/LinearAxisAnimator.js +66 -0
  312. package/dist/components/robots/LinearAxisAnimator.js.map +1 -0
  313. package/dist/components/robots/MotionGroupVisualizer.cjs +2 -0
  314. package/dist/components/robots/MotionGroupVisualizer.cjs.map +1 -0
  315. package/dist/components/robots/MotionGroupVisualizer.d.ts +1 -0
  316. package/dist/components/robots/MotionGroupVisualizer.d.ts.map +1 -1
  317. package/dist/components/robots/MotionGroupVisualizer.js +21 -0
  318. package/dist/components/robots/MotionGroupVisualizer.js.map +1 -0
  319. package/dist/components/robots/Robot.cjs +2 -0
  320. package/dist/components/robots/Robot.cjs.map +1 -0
  321. package/dist/components/robots/Robot.d.ts +1 -0
  322. package/dist/components/robots/Robot.d.ts.map +1 -1
  323. package/dist/components/robots/Robot.js +31 -0
  324. package/dist/components/robots/Robot.js.map +1 -0
  325. package/dist/components/robots/RobotAnimator.cjs +2 -0
  326. package/dist/components/robots/RobotAnimator.cjs.map +1 -0
  327. package/dist/components/robots/RobotAnimator.js +66 -0
  328. package/dist/components/robots/RobotAnimator.js.map +1 -0
  329. package/dist/components/robots/SupportedLinearAxis.cjs +2 -0
  330. package/dist/components/robots/SupportedLinearAxis.cjs.map +1 -0
  331. package/dist/components/robots/SupportedLinearAxis.d.ts +1 -0
  332. package/dist/components/robots/SupportedLinearAxis.d.ts.map +1 -1
  333. package/dist/components/robots/SupportedLinearAxis.js +82 -0
  334. package/dist/components/robots/SupportedLinearAxis.js.map +1 -0
  335. package/dist/components/robots/SupportedRobot.cjs +2 -0
  336. package/dist/components/robots/SupportedRobot.cjs.map +1 -0
  337. package/dist/components/robots/SupportedRobot.d.ts +1 -0
  338. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  339. package/dist/components/robots/SupportedRobot.js +82 -0
  340. package/dist/components/robots/SupportedRobot.js.map +1 -0
  341. package/dist/components/robots/ghostStyle.cjs +2 -0
  342. package/dist/components/robots/ghostStyle.cjs.map +1 -0
  343. package/dist/components/robots/ghostStyle.js +40 -0
  344. package/dist/components/robots/ghostStyle.js.map +1 -0
  345. package/dist/components/robots/manufacturerHomePositions.cjs +2 -0
  346. package/dist/components/robots/manufacturerHomePositions.cjs.map +1 -0
  347. package/dist/components/robots/manufacturerHomePositions.js +51 -0
  348. package/dist/components/robots/manufacturerHomePositions.js.map +1 -0
  349. package/dist/components/robots/robotModelLogic.cjs +2 -0
  350. package/dist/components/robots/robotModelLogic.cjs.map +1 -0
  351. package/dist/components/robots/robotModelLogic.js +61 -0
  352. package/dist/components/robots/robotModelLogic.js.map +1 -0
  353. package/dist/components/safetyBar/ControllerTypeIndicator.cjs +2 -0
  354. package/dist/components/safetyBar/ControllerTypeIndicator.cjs.map +1 -0
  355. package/dist/components/safetyBar/ControllerTypeIndicator.d.ts +1 -1
  356. package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
  357. package/dist/components/safetyBar/ControllerTypeIndicator.js +71 -0
  358. package/dist/components/safetyBar/ControllerTypeIndicator.js.map +1 -0
  359. package/dist/components/safetyBar/IndicatorWithExplanation.cjs +2 -0
  360. package/dist/components/safetyBar/IndicatorWithExplanation.cjs.map +1 -0
  361. package/dist/components/safetyBar/IndicatorWithExplanation.d.ts +1 -0
  362. package/dist/components/safetyBar/IndicatorWithExplanation.d.ts.map +1 -1
  363. package/dist/components/safetyBar/IndicatorWithExplanation.js +123 -0
  364. package/dist/components/safetyBar/IndicatorWithExplanation.js.map +1 -0
  365. package/dist/components/safetyBar/OperationModeIndicator.cjs +2 -0
  366. package/dist/components/safetyBar/OperationModeIndicator.cjs.map +1 -0
  367. package/dist/components/safetyBar/OperationModeIndicator.d.ts +1 -1
  368. package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
  369. package/dist/components/safetyBar/OperationModeIndicator.js +75 -0
  370. package/dist/components/safetyBar/OperationModeIndicator.js.map +1 -0
  371. package/dist/components/safetyBar/SafetyBar.cjs +2 -0
  372. package/dist/components/safetyBar/SafetyBar.cjs.map +1 -0
  373. package/dist/components/safetyBar/SafetyBar.d.ts +1 -0
  374. package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
  375. package/dist/components/safetyBar/SafetyBar.js +66 -0
  376. package/dist/components/safetyBar/SafetyBar.js.map +1 -0
  377. package/dist/components/safetyBar/SafetyStateIndicator.cjs +2 -0
  378. package/dist/components/safetyBar/SafetyStateIndicator.cjs.map +1 -0
  379. package/dist/components/safetyBar/SafetyStateIndicator.d.ts +1 -1
  380. package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
  381. package/dist/components/safetyBar/SafetyStateIndicator.js +126 -0
  382. package/dist/components/safetyBar/SafetyStateIndicator.js.map +1 -0
  383. package/dist/components/safetyBar/icons/controller-type-physical.svg.cjs +2 -0
  384. package/dist/components/safetyBar/icons/controller-type-physical.svg.cjs.map +1 -0
  385. package/dist/components/safetyBar/icons/controller-type-physical.svg.d.ts +3 -0
  386. package/dist/components/safetyBar/icons/controller-type-physical.svg.js +11 -0
  387. package/dist/components/safetyBar/icons/controller-type-physical.svg.js.map +1 -0
  388. package/dist/components/safetyBar/icons/controller-type-virtual.svg.cjs +2 -0
  389. package/dist/components/safetyBar/icons/controller-type-virtual.svg.cjs.map +1 -0
  390. package/dist/components/safetyBar/icons/controller-type-virtual.svg.d.ts +3 -0
  391. package/dist/components/safetyBar/icons/controller-type-virtual.svg.js +11 -0
  392. package/dist/components/safetyBar/icons/controller-type-virtual.svg.js.map +1 -0
  393. package/dist/components/safetyBar/icons/operation-mode-automatic.svg.cjs +2 -0
  394. package/dist/components/safetyBar/icons/operation-mode-automatic.svg.cjs.map +1 -0
  395. package/dist/components/safetyBar/icons/operation-mode-automatic.svg.d.ts +3 -0
  396. package/dist/components/safetyBar/icons/operation-mode-automatic.svg.js +11 -0
  397. package/dist/components/safetyBar/icons/operation-mode-automatic.svg.js.map +1 -0
  398. package/dist/components/safetyBar/icons/operation-mode-error.svg.cjs +2 -0
  399. package/dist/components/safetyBar/icons/operation-mode-error.svg.cjs.map +1 -0
  400. package/dist/components/safetyBar/icons/operation-mode-error.svg.d.ts +3 -0
  401. package/dist/components/safetyBar/icons/operation-mode-error.svg.js +11 -0
  402. package/dist/components/safetyBar/icons/operation-mode-error.svg.js.map +1 -0
  403. package/dist/components/safetyBar/icons/operation-mode-manual.svg.cjs +2 -0
  404. package/dist/components/safetyBar/icons/operation-mode-manual.svg.cjs.map +1 -0
  405. package/dist/components/safetyBar/icons/operation-mode-manual.svg.d.ts +3 -0
  406. package/dist/components/safetyBar/icons/operation-mode-manual.svg.js +11 -0
  407. package/dist/components/safetyBar/icons/operation-mode-manual.svg.js.map +1 -0
  408. package/dist/components/safetyBar/icons/safety-state-error.svg.cjs +2 -0
  409. package/dist/components/safetyBar/icons/safety-state-error.svg.cjs.map +1 -0
  410. package/dist/components/safetyBar/icons/safety-state-error.svg.d.ts +3 -0
  411. package/dist/components/safetyBar/icons/safety-state-error.svg.js +11 -0
  412. package/dist/components/safetyBar/icons/safety-state-error.svg.js.map +1 -0
  413. package/dist/components/safetyBar/icons/safety-state-estop.svg.cjs +2 -0
  414. package/dist/components/safetyBar/icons/safety-state-estop.svg.cjs.map +1 -0
  415. package/dist/components/safetyBar/icons/safety-state-estop.svg.d.ts +3 -0
  416. package/dist/components/safetyBar/icons/safety-state-estop.svg.js +11 -0
  417. package/dist/components/safetyBar/icons/safety-state-estop.svg.js.map +1 -0
  418. package/dist/components/safetyBar/icons/safety-state-manual-action-required.svg.cjs +2 -0
  419. package/dist/components/safetyBar/icons/safety-state-manual-action-required.svg.cjs.map +1 -0
  420. package/dist/components/safetyBar/icons/safety-state-manual-action-required.svg.d.ts +3 -0
  421. package/dist/components/safetyBar/icons/safety-state-manual-action-required.svg.js +11 -0
  422. package/dist/components/safetyBar/icons/safety-state-manual-action-required.svg.js.map +1 -0
  423. package/dist/components/safetyBar/icons/safety-state-normal.svg.cjs +2 -0
  424. package/dist/components/safetyBar/icons/safety-state-normal.svg.cjs.map +1 -0
  425. package/dist/components/safetyBar/icons/safety-state-normal.svg.d.ts +3 -0
  426. package/dist/components/safetyBar/icons/safety-state-normal.svg.js +11 -0
  427. package/dist/components/safetyBar/icons/safety-state-normal.svg.js.map +1 -0
  428. package/dist/components/safetyBar/icons/safety-state-stop.svg.cjs +2 -0
  429. package/dist/components/safetyBar/icons/safety-state-stop.svg.cjs.map +1 -0
  430. package/dist/components/safetyBar/icons/safety-state-stop.svg.d.ts +3 -0
  431. package/dist/components/safetyBar/icons/safety-state-stop.svg.js +11 -0
  432. package/dist/components/safetyBar/icons/safety-state-stop.svg.js.map +1 -0
  433. package/dist/components/utils/converters.cjs +2 -0
  434. package/dist/components/utils/converters.cjs.map +1 -0
  435. package/dist/components/utils/converters.js +40 -0
  436. package/dist/components/utils/converters.js.map +1 -0
  437. package/dist/components/utils/errorHandling.cjs +2 -0
  438. package/dist/components/utils/errorHandling.cjs.map +1 -0
  439. package/dist/components/utils/errorHandling.js +14 -0
  440. package/dist/components/utils/errorHandling.js.map +1 -0
  441. package/dist/components/utils/hooks.cjs +2 -0
  442. package/dist/components/utils/hooks.cjs.map +1 -0
  443. package/dist/components/utils/hooks.js +29 -0
  444. package/dist/components/utils/hooks.js.map +1 -0
  445. package/dist/components/utils/interpolation.cjs +2 -0
  446. package/dist/components/utils/interpolation.cjs.map +1 -0
  447. package/dist/components/utils/interpolation.js +138 -0
  448. package/dist/components/utils/interpolation.js.map +1 -0
  449. package/dist/core.cjs +2 -0
  450. package/dist/core.cjs.map +1 -0
  451. package/dist/core.js +81 -0
  452. package/dist/core.js.map +1 -0
  453. package/dist/externalizeComponent.cjs +2 -0
  454. package/dist/externalizeComponent.cjs.map +1 -0
  455. package/dist/externalizeComponent.js +13 -0
  456. package/dist/externalizeComponent.js.map +1 -0
  457. package/dist/i18n/config.cjs +2 -0
  458. package/dist/i18n/config.cjs.map +1 -0
  459. package/dist/i18n/config.js +25 -0
  460. package/dist/i18n/config.js.map +1 -0
  461. package/dist/i18n/locales/de/translations.json.cjs +3 -0
  462. package/dist/i18n/locales/de/translations.json.cjs.map +1 -0
  463. package/dist/i18n/locales/de/translations.json.js +94 -0
  464. package/dist/i18n/locales/de/translations.json.js.map +1 -0
  465. package/dist/i18n/locales/en/translations.json.cjs +2 -0
  466. package/dist/i18n/locales/en/translations.json.cjs.map +1 -0
  467. package/dist/i18n/locales/en/translations.json.js +94 -0
  468. package/dist/i18n/locales/en/translations.json.js.map +1 -0
  469. package/dist/icons/DropdownArrowIcon.cjs +2 -0
  470. package/dist/icons/DropdownArrowIcon.cjs.map +1 -0
  471. package/dist/icons/DropdownArrowIcon.js +14 -0
  472. package/dist/icons/DropdownArrowIcon.js.map +1 -0
  473. package/dist/icons/axis-x.svg.cjs +2 -0
  474. package/dist/icons/axis-x.svg.cjs.map +1 -0
  475. package/dist/icons/axis-x.svg.d.ts +3 -0
  476. package/dist/icons/axis-x.svg.js +11 -0
  477. package/dist/icons/axis-x.svg.js.map +1 -0
  478. package/dist/icons/axis-y.svg.cjs +2 -0
  479. package/dist/icons/axis-y.svg.cjs.map +1 -0
  480. package/dist/icons/axis-y.svg.d.ts +3 -0
  481. package/dist/icons/axis-y.svg.js +11 -0
  482. package/dist/icons/axis-y.svg.js.map +1 -0
  483. package/dist/icons/axis-z.svg.cjs +2 -0
  484. package/dist/icons/axis-z.svg.cjs.map +1 -0
  485. package/dist/icons/axis-z.svg.d.ts +3 -0
  486. package/dist/icons/axis-z.svg.js +11 -0
  487. package/dist/icons/axis-z.svg.js.map +1 -0
  488. package/dist/icons/home.svg.cjs +2 -0
  489. package/dist/icons/home.svg.cjs.map +1 -0
  490. package/dist/icons/home.svg.d.ts +3 -0
  491. package/dist/icons/home.svg.js +11 -0
  492. package/dist/icons/home.svg.js.map +1 -0
  493. package/dist/icons/jog-minus.svg.cjs +2 -0
  494. package/dist/icons/jog-minus.svg.cjs.map +1 -0
  495. package/dist/icons/jog-minus.svg.d.ts +3 -0
  496. package/dist/icons/jog-minus.svg.js +11 -0
  497. package/dist/icons/jog-minus.svg.js.map +1 -0
  498. package/dist/icons/jog-plus.svg.cjs +2 -0
  499. package/dist/icons/jog-plus.svg.cjs.map +1 -0
  500. package/dist/icons/jog-plus.svg.d.ts +3 -0
  501. package/dist/icons/jog-plus.svg.js +11 -0
  502. package/dist/icons/jog-plus.svg.js.map +1 -0
  503. package/dist/icons/jogging.svg.cjs +2 -0
  504. package/dist/icons/jogging.svg.cjs.map +1 -0
  505. package/dist/icons/jogging.svg.d.ts +3 -0
  506. package/dist/icons/jogging.svg.js +11 -0
  507. package/dist/icons/jogging.svg.js.map +1 -0
  508. package/dist/icons/orientation-coord-system.svg.cjs +2 -0
  509. package/dist/icons/orientation-coord-system.svg.cjs.map +1 -0
  510. package/dist/icons/orientation-coord-system.svg.d.ts +3 -0
  511. package/dist/icons/orientation-coord-system.svg.js +11 -0
  512. package/dist/icons/orientation-coord-system.svg.js.map +1 -0
  513. package/dist/icons/orientation-tool.svg.cjs +2 -0
  514. package/dist/icons/orientation-tool.svg.cjs.map +1 -0
  515. package/dist/icons/orientation-tool.svg.d.ts +3 -0
  516. package/dist/icons/orientation-tool.svg.js +11 -0
  517. package/dist/icons/orientation-tool.svg.js.map +1 -0
  518. package/dist/icons/robot.svg.cjs +2 -0
  519. package/dist/icons/robot.svg.cjs.map +1 -0
  520. package/dist/icons/robot.svg.d.ts +3 -0
  521. package/dist/icons/robot.svg.js +11 -0
  522. package/dist/icons/robot.svg.js.map +1 -0
  523. package/dist/icons/rotation.svg.cjs +2 -0
  524. package/dist/icons/rotation.svg.cjs.map +1 -0
  525. package/dist/icons/rotation.svg.d.ts +3 -0
  526. package/dist/icons/rotation.svg.js +11 -0
  527. package/dist/icons/rotation.svg.js.map +1 -0
  528. package/dist/icons/wbLogo.svg.cjs +2 -0
  529. package/dist/icons/wbLogo.svg.cjs.map +1 -0
  530. package/dist/icons/wbLogo.svg.d.ts +3 -0
  531. package/dist/icons/wbLogo.svg.js +11 -0
  532. package/dist/icons/wbLogo.svg.js.map +1 -0
  533. package/dist/index.cjs +2 -0
  534. package/dist/index.cjs.map +1 -0
  535. package/dist/index.js +153 -0
  536. package/dist/index.js.map +1 -0
  537. package/dist/lib/ConnectedMotionGroup.cjs +4 -0
  538. package/dist/lib/ConnectedMotionGroup.cjs.map +1 -0
  539. package/dist/lib/ConnectedMotionGroup.d.ts +1 -0
  540. package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -1
  541. package/dist/lib/ConnectedMotionGroup.js +250 -0
  542. package/dist/lib/ConnectedMotionGroup.js.map +1 -0
  543. package/dist/lib/JoggerConnection.cjs +2 -0
  544. package/dist/lib/JoggerConnection.cjs.map +1 -0
  545. package/dist/lib/JoggerConnection.d.ts +1 -0
  546. package/dist/lib/JoggerConnection.d.ts.map +1 -1
  547. package/dist/lib/JoggerConnection.js +342 -0
  548. package/dist/lib/JoggerConnection.js.map +1 -0
  549. package/dist/lib/MotionStreamConnection.cjs +3 -0
  550. package/dist/lib/MotionStreamConnection.cjs.map +1 -0
  551. package/dist/lib/MotionStreamConnection.d.ts +1 -0
  552. package/dist/lib/MotionStreamConnection.d.ts.map +1 -1
  553. package/dist/lib/MotionStreamConnection.js +94 -0
  554. package/dist/lib/MotionStreamConnection.js.map +1 -0
  555. package/dist/lib/motionStateUpdate.cjs +2 -0
  556. package/dist/lib/motionStateUpdate.cjs.map +1 -0
  557. package/dist/lib/motionStateUpdate.js +49 -0
  558. package/dist/lib/motionStateUpdate.js.map +1 -0
  559. package/dist/test/consumer.test.d.ts +2 -0
  560. package/dist/test/consumer.test.d.ts.map +1 -0
  561. package/dist/themes/createDarkTheme.cjs +2 -0
  562. package/dist/themes/createDarkTheme.cjs.map +1 -0
  563. package/dist/themes/createDarkTheme.js +344 -0
  564. package/dist/themes/createDarkTheme.js.map +1 -0
  565. package/dist/themes/createLightTheme.cjs +2 -0
  566. package/dist/themes/createLightTheme.cjs.map +1 -0
  567. package/dist/themes/createLightTheme.js +9 -0
  568. package/dist/themes/createLightTheme.js.map +1 -0
  569. package/dist/themes/theming.cjs +2 -0
  570. package/dist/themes/theming.cjs.map +1 -0
  571. package/dist/themes/theming.js +14 -0
  572. package/dist/themes/theming.js.map +1 -0
  573. package/dist/wb-icons.cjs +2 -0
  574. package/dist/wb-icons.cjs.map +1 -0
  575. package/dist/wb-icons.js +47 -0
  576. package/dist/wb-icons.js.map +1 -0
  577. package/package.json +20 -9
  578. package/src/components/3d-viewport/CoordinateSystemTransform.tsx +2 -0
  579. package/src/components/3d-viewport/PresetEnvironment.tsx +2 -0
  580. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -0
  581. package/src/components/3d-viewport/TrajectoryRenderer.tsx +2 -0
  582. package/src/components/AppHeader.tsx +2 -0
  583. package/src/components/CopyableText.tsx +2 -0
  584. package/src/components/CycleTimer/CycleTimer.ts +2 -0
  585. package/src/components/CycleTimer/index.tsx +2 -0
  586. package/src/components/CycleTimer.tsx +2 -0
  587. package/src/components/DataGrid.tsx +2 -0
  588. package/src/components/LoadingCover.tsx +2 -0
  589. package/src/components/LogPanel.tsx +2 -0
  590. package/src/components/LogStore.ts +2 -0
  591. package/src/components/LogViewer.tsx +2 -0
  592. package/src/components/ProgramControl.tsx +2 -0
  593. package/src/components/ProgramStateIndicator.tsx +2 -0
  594. package/src/components/RobotCard.tsx +2 -0
  595. package/src/components/RobotListItem.tsx +2 -0
  596. package/src/components/RobotSetupReadinessIndicator.tsx +2 -0
  597. package/src/components/SelectableFab.tsx +2 -0
  598. package/src/components/TabBar.tsx +2 -0
  599. package/src/components/ThemeSelect.tsx +2 -0
  600. package/src/components/Timer/Timer.ts +2 -0
  601. package/src/components/Timer/index.tsx +2 -0
  602. package/src/components/Timer.ts +4 -0
  603. package/src/components/TransparentOverlay.tsx +2 -0
  604. package/src/components/VelocitySlider.tsx +2 -0
  605. package/src/components/jogging/JoggingCartesianAxisControl.tsx +2 -0
  606. package/src/components/jogging/JoggingJointValueControl.tsx +2 -0
  607. package/src/components/jogging/JoggingPanel.tsx +2 -0
  608. package/src/components/jogging/JoggingStore.ts +2 -0
  609. package/src/components/jogging/PoseCartesianValues.tsx +2 -0
  610. package/src/components/jogging/PoseJointValues.tsx +2 -0
  611. package/src/components/modal/NoMotionGroupModal.tsx +2 -0
  612. package/src/components/robots/DHLinearAxis.tsx +2 -0
  613. package/src/components/robots/DHRobot.tsx +2 -0
  614. package/src/components/robots/GenericRobot.tsx +2 -0
  615. package/src/components/robots/LinearAxis.tsx +2 -0
  616. package/src/components/robots/MotionGroupVisualizer.tsx +2 -0
  617. package/src/components/robots/Robot.tsx +2 -0
  618. package/src/components/robots/SupportedLinearAxis.tsx +2 -0
  619. package/src/components/robots/SupportedRobot.tsx +2 -0
  620. package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -0
  621. package/src/components/safetyBar/IndicatorWithExplanation.tsx +2 -0
  622. package/src/components/safetyBar/OperationModeIndicator.tsx +2 -0
  623. package/src/components/safetyBar/SafetyBar.tsx +2 -0
  624. package/src/components/safetyBar/SafetyStateIndicator.tsx +2 -0
  625. package/src/lib/ConnectedMotionGroup.ts +2 -0
  626. package/src/lib/JoggerConnection.ts +2 -0
  627. package/src/lib/MotionStreamConnection.ts +2 -0
  628. package/src/test/consumer.test.ts +230 -0
  629. package/dist/3d.cjs.js +0 -2
  630. package/dist/3d.cjs.js.map +0 -1
  631. package/dist/3d.es.js +0 -19
  632. package/dist/3d.es.js.map +0 -1
  633. package/dist/MotionGroupVisualizer-B-e22qXF.cjs +0 -2
  634. package/dist/MotionGroupVisualizer-B-e22qXF.cjs.map +0 -1
  635. package/dist/MotionGroupVisualizer-CIASsBC6.js +0 -1433
  636. package/dist/MotionGroupVisualizer-CIASsBC6.js.map +0 -1
  637. package/dist/auth0-spa-js.production.esm-CVEdrQ4-.cjs +0 -5
  638. package/dist/auth0-spa-js.production.esm-CVEdrQ4-.cjs.map +0 -1
  639. package/dist/auth0-spa-js.production.esm-Cr9w0sUa.js +0 -4217
  640. package/dist/auth0-spa-js.production.esm-Cr9w0sUa.js.map +0 -1
  641. package/dist/core.cjs.js +0 -2
  642. package/dist/core.cjs.js.map +0 -1
  643. package/dist/core.es.js +0 -52
  644. package/dist/core.es.js.map +0 -1
  645. package/dist/index.cjs.js +0 -2
  646. package/dist/index.cjs.js.map +0 -1
  647. package/dist/index.es.js +0 -92
  648. package/dist/index.es.js.map +0 -1
  649. package/dist/interpolation-BIB6FC35.cjs +0 -198
  650. package/dist/interpolation-BIB6FC35.cjs.map +0 -1
  651. package/dist/interpolation-lSTX6ZXZ.js +0 -14559
  652. package/dist/interpolation-lSTX6ZXZ.js.map +0 -1
  653. package/dist/safety-state-stop-ClWLVLMl.cjs +0 -2
  654. package/dist/safety-state-stop-ClWLVLMl.cjs.map +0 -1
  655. package/dist/safety-state-stop-DuMBCxN5.js +0 -91
  656. package/dist/safety-state-stop-DuMBCxN5.js.map +0 -1
  657. package/dist/theming-D_pShDEg.js +0 -32236
  658. package/dist/theming-D_pShDEg.js.map +0 -1
  659. package/dist/theming-L5E8VSae.cjs +0 -84
  660. package/dist/theming-L5E8VSae.cjs.map +0 -1
  661. package/dist/wb-icons.cjs.js +0 -2
  662. package/dist/wb-icons.cjs.js.map +0 -1
  663. package/dist/wb-icons.es.js +0 -27
  664. package/dist/wb-icons.es.js.map +0 -1
  665. package/dist/wbLogo-CObCmqTw.js +0 -31
  666. package/dist/wbLogo-CObCmqTw.js.map +0 -1
  667. package/dist/wbLogo-G_IfZ03l.cjs +0 -2
  668. package/dist/wbLogo-G_IfZ03l.cjs.map +0 -1
@@ -0,0 +1,86 @@
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import { observer as b } from "mobx-react-lite";
3
+ import { useRef as j, useEffect as n } from "react";
4
+ import { externalizeComponent as z } from "../../externalizeComponent.js";
5
+ import { DefaultVariant as C } from "./DefaultVariant.js";
6
+ import { SmallVariant as D } from "./SmallVariant.js";
7
+ import { useAnimations as F } from "./useAnimations.js";
8
+ import { useTimerLogic as L } from "./useTimerLogic.js";
9
+ const J = z(
10
+ b(
11
+ ({
12
+ onCycleComplete: o,
13
+ onCycleEnd: S,
14
+ onMeasuringComplete: g,
15
+ autoStart: v = !0,
16
+ variant: P = "default",
17
+ compact: T = !1,
18
+ className: a,
19
+ hasError: e = !1
20
+ }) => {
21
+ const i = j(void 0), {
22
+ animationState: m,
23
+ triggerPauseAnimation: I,
24
+ triggerErrorAnimation: x,
25
+ clearErrorAnimation: E,
26
+ startPulsatingAnimation: R,
27
+ stopPulsatingAnimation: s,
28
+ startIdleAnimations: u,
29
+ stopIdleAnimations: f,
30
+ triggerFadeTransition: l,
31
+ setInitialAnimationState: c,
32
+ cleanup: p
33
+ } = F(), { timerState: t, controls: d } = L({
34
+ autoStart: v,
35
+ onCycleEnd: S,
36
+ onMeasuringComplete: g,
37
+ hasError: e,
38
+ onPauseAnimation: I,
39
+ onErrorAnimation: x,
40
+ onClearErrorAnimation: E,
41
+ onStartPulsating: R
42
+ });
43
+ return n(() => {
44
+ const r = i.current;
45
+ i.current !== void 0 && r !== t.currentState ? (r === "measured" && s(), r === "idle" && f(), l()) : c(), t.currentState === "idle" && u(), i.current = t.currentState;
46
+ }, [
47
+ t.currentState,
48
+ s,
49
+ f,
50
+ u,
51
+ l,
52
+ c
53
+ ]), n(() => {
54
+ let r = !0;
55
+ const V = setTimeout(() => {
56
+ r && o(d);
57
+ }, 0);
58
+ return () => {
59
+ r = !1, clearTimeout(V);
60
+ };
61
+ }, [o, d]), n(() => p, [p]), P === "small" ? /* @__PURE__ */ A(
62
+ D,
63
+ {
64
+ timerState: t,
65
+ animationState: m,
66
+ hasError: e,
67
+ compact: T,
68
+ className: a
69
+ }
70
+ ) : /* @__PURE__ */ A(
71
+ C,
72
+ {
73
+ timerState: t,
74
+ animationState: m,
75
+ hasError: e,
76
+ className: a
77
+ }
78
+ );
79
+ }
80
+ )
81
+ );
82
+ export {
83
+ J as CycleTimer,
84
+ J as default
85
+ };
86
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/CycleTimer/index.tsx"],"sourcesContent":["import { observer } from \"mobx-react-lite\"\nimport { useEffect, useRef } from \"react\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { DefaultVariant } from \"./DefaultVariant\"\nimport { SmallVariant } from \"./SmallVariant\"\nimport type { CycleTimerProps } from \"./types\"\nimport { useAnimations } from \"./useAnimations\"\nimport { useTimerLogic } from \"./useTimerLogic\"\n\n/**\n * A circular gauge timer component for cycle-specific timing operations\n *\n * Features:\n * - Custom SVG circular gauge with 264px diameter and 40px thickness\n * - Multiple states: idle, measuring, measured, countdown, success\n * - Idle state: shows \"Waiting for program cycle\" with transparent inner circle\n * - Measuring state: counts up with \"Cycle Time\" / \"measuring...\" labels\n * - Measured state: shows final time with \"Cycle Time\" / \"determined\" labels in pulsating green\n * - Countdown mode: shows remaining time prominently, counts down to zero\n * - Success state: brief green flash after cycle completion\n * - Displays appropriate labels based on state\n * - Automatically counts down and triggers callback when reaching zero\n * - Full timer control: start, pause, resume functionality\n * - Support for starting with elapsed time (resume mid-cycle)\n * - Error state support: pauses timer and shows error styling (red color)\n * - Smooth fade transitions between different text states\n * - Pulsating text animation for completed measuring state\n * - Fully localized with i18next\n * - Material-UI theming integration\n * - Small variant with animated progress icon (gauge border only) next to text\n */\nexport const CycleTimer = externalizeComponent(\n observer(\n ({\n onCycleComplete,\n onCycleEnd,\n onMeasuringComplete,\n autoStart = true,\n variant = \"default\",\n compact = false,\n className,\n hasError = false,\n }: CycleTimerProps) => {\n const prevStateRef = useRef<string | undefined>(undefined)\n\n // Initialize animation hooks\n const {\n animationState,\n triggerPauseAnimation,\n triggerErrorAnimation,\n clearErrorAnimation,\n startPulsatingAnimation,\n stopPulsatingAnimation,\n startIdleAnimations,\n stopIdleAnimations,\n triggerFadeTransition,\n setInitialAnimationState,\n cleanup,\n } = useAnimations()\n\n // Initialize timer logic\n const { timerState, controls } = useTimerLogic({\n autoStart,\n onCycleEnd,\n onMeasuringComplete,\n hasError,\n onPauseAnimation: triggerPauseAnimation,\n onErrorAnimation: triggerErrorAnimation,\n onClearErrorAnimation: clearErrorAnimation,\n onStartPulsating: startPulsatingAnimation,\n })\n\n // Handle state changes with fade transitions\n useEffect(() => {\n const prevState = prevStateRef.current\n\n if (\n prevStateRef.current !== undefined &&\n prevState !== timerState.currentState\n ) {\n // Stop pulsating animation if leaving measured state\n if (prevState === \"measured\") {\n stopPulsatingAnimation()\n }\n\n // Stop idle animations if leaving idle state\n if (prevState === \"idle\") {\n stopIdleAnimations()\n }\n\n // Trigger fade transition\n triggerFadeTransition()\n } else {\n // No state change or first time - set initial state\n setInitialAnimationState()\n }\n\n // Start idle animations if entering idle state\n if (timerState.currentState === \"idle\") {\n startIdleAnimations()\n }\n\n prevStateRef.current = timerState.currentState\n }, [\n timerState.currentState,\n stopPulsatingAnimation,\n stopIdleAnimations,\n startIdleAnimations,\n triggerFadeTransition,\n setInitialAnimationState,\n ])\n\n // Provide controls to parent component\n useEffect(() => {\n let isMounted = true\n const timeoutId = setTimeout(() => {\n if (isMounted) {\n onCycleComplete(controls)\n }\n }, 0)\n\n return () => {\n isMounted = false\n clearTimeout(timeoutId)\n }\n }, [onCycleComplete, controls])\n\n // Cleanup on unmount\n useEffect(() => {\n return cleanup\n }, [cleanup])\n\n // Render appropriate variant\n if (variant === \"small\") {\n return (\n <SmallVariant\n timerState={timerState}\n animationState={animationState}\n hasError={hasError}\n compact={compact}\n className={className}\n />\n )\n }\n\n return (\n <DefaultVariant\n timerState={timerState}\n animationState={animationState}\n hasError={hasError}\n className={className}\n />\n )\n },\n ),\n)\n\nexport default CycleTimer\n"],"names":["CycleTimer","externalizeComponent","observer","onCycleComplete","onCycleEnd","onMeasuringComplete","autoStart","variant","compact","className","hasError","prevStateRef","useRef","animationState","triggerPauseAnimation","triggerErrorAnimation","clearErrorAnimation","startPulsatingAnimation","stopPulsatingAnimation","startIdleAnimations","stopIdleAnimations","triggerFadeTransition","setInitialAnimationState","cleanup","useAnimations","timerState","controls","useTimerLogic","useEffect","prevState","isMounted","timeoutId","jsx","SmallVariant","DefaultVariant"],"mappings":";;;;;;;;AA+BO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,IACE,CAAC;AAAA,MACC,iBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,SAAAC,IAAU;AAAA,MACV,WAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,IAAA,MACU;AACrB,YAAMC,IAAeC,EAA2B,MAAS,GAGnD;AAAA,QACJ,gBAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,qBAAAC;AAAA,QACA,yBAAAC;AAAA,QACA,wBAAAC;AAAA,QACA,qBAAAC;AAAA,QACA,oBAAAC;AAAA,QACA,uBAAAC;AAAA,QACA,0BAAAC;AAAA,QACA,SAAAC;AAAA,MAAA,IACEC,EAAA,GAGE,EAAE,YAAAC,GAAY,UAAAC,EAAA,IAAaC,EAAc;AAAA,QAC7C,WAAArB;AAAA,QACA,YAAAF;AAAA,QACA,qBAAAC;AAAA,QACA,UAAAK;AAAA,QACA,kBAAkBI;AAAA,QAClB,kBAAkBC;AAAA,QAClB,uBAAuBC;AAAA,QACvB,kBAAkBC;AAAA,MAAA,CACnB;AA+DD,aA5DAW,EAAU,MAAM;AACd,cAAMC,IAAYlB,EAAa;AAE/B,QACEA,EAAa,YAAY,UACzBkB,MAAcJ,EAAW,gBAGrBI,MAAc,cAChBX,EAAA,GAIEW,MAAc,UAChBT,EAAA,GAIFC,EAAA,KAGAC,EAAA,GAIEG,EAAW,iBAAiB,UAC9BN,EAAA,GAGFR,EAAa,UAAUc,EAAW;AAAA,MACpC,GAAG;AAAA,QACDA,EAAW;AAAA,QACXP;AAAA,QACAE;AAAA,QACAD;AAAA,QACAE;AAAA,QACAC;AAAA,MAAA,CACD,GAGDM,EAAU,MAAM;AACd,YAAIE,IAAY;AAChB,cAAMC,IAAY,WAAW,MAAM;AACjC,UAAID,KACF3B,EAAgBuB,CAAQ;AAAA,QAE5B,GAAG,CAAC;AAEJ,eAAO,MAAM;AACX,UAAAI,IAAY,IACZ,aAAaC,CAAS;AAAA,QACxB;AAAA,MACF,GAAG,CAAC5B,GAAiBuB,CAAQ,CAAC,GAG9BE,EAAU,MACDL,GACN,CAACA,CAAO,CAAC,GAGRhB,MAAY,UAEZ,gBAAAyB;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,YAAAR;AAAA,UACA,gBAAAZ;AAAA,UACA,UAAAH;AAAA,UACA,SAAAF;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA,IAMJ,gBAAAuB;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,YAAAT;AAAA,UACA,gBAAAZ;AAAA,UACA,UAAAH;AAAA,UACA,WAAAD;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),R=()=>{const[f,n]=t.useState({showPauseAnimation:!1,showErrorAnimation:!1,showPulsatingText:!1,pulsatingFinished:!1,showLabels:!0,showMainText:!0,showIdlePulsating:!1,idleDotsCount:0}),i=t.useRef(null),r=t.useRef(null),s=t.useRef(null),o=t.useRef(null),c=t.useRef(0),a=t.useRef(null),u=t.useRef(null),m=t.useCallback(()=>{n(e=>({...e,showPauseAnimation:!0})),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{n(e=>({...e,showPauseAnimation:!1}))},800)},[]),h=t.useCallback(()=>{n(e=>({...e,showErrorAnimation:!0})),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{n(e=>({...e,showErrorAnimation:!1}))},600)},[]),g=t.useCallback(()=>{n(e=>({...e,showErrorAnimation:!1})),r.current&&clearTimeout(r.current)},[]),w=t.useCallback(e=>{c.current=0,n(l=>({...l,showPulsatingText:!0,pulsatingFinished:!1})),setTimeout(()=>{n(l=>({...l,pulsatingFinished:!0})),s.current=setInterval(()=>{n(l=>({...l,showPulsatingText:!l.showPulsatingText}))},2e3),e&&e()},800)},[]),T=t.useCallback(()=>{s.current&&(clearInterval(s.current),s.current=null),n(e=>({...e,showPulsatingText:!1,pulsatingFinished:!1})),c.current=0},[]),d=t.useCallback(()=>{n(e=>({...e,showIdlePulsating:!0})),a.current=setInterval(()=>{n(e=>({...e,showIdlePulsating:!e.showIdlePulsating}))},2e3),u.current=setInterval(()=>{n(e=>({...e,idleDotsCount:(e.idleDotsCount+1)%4}))},800)},[]),A=t.useCallback(()=>{a.current&&(clearInterval(a.current),a.current=null),u.current&&(clearInterval(u.current),u.current=null),n(e=>({...e,showIdlePulsating:!1,idleDotsCount:0}))},[]),I=t.useCallback(()=>{n(e=>({...e,showLabels:!1,showMainText:!1})),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n(e=>({...e,showLabels:!0,showMainText:!0}))},200)},[]),P=t.useCallback(()=>{n(e=>({...e,showLabels:!0,showMainText:!0}))},[]),b=t.useCallback(()=>{i.current&&clearTimeout(i.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current),a.current&&clearInterval(a.current),u.current&&clearInterval(u.current)},[]);return{animationState:f,triggerPauseAnimation:m,triggerErrorAnimation:h,clearErrorAnimation:g,startPulsatingAnimation:w,stopPulsatingAnimation:T,startIdleAnimations:d,stopIdleAnimations:A,triggerFadeTransition:I,setInitialAnimationState:P,cleanup:b}};exports.useAnimations=R;
2
+ //# sourceMappingURL=useAnimations.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimations.cjs","sources":["../../../src/components/CycleTimer/useAnimations.ts"],"sourcesContent":["import { useCallback, useRef, useState } from \"react\"\nimport type { AnimationState } from \"./types\"\n\nexport const useAnimations = () => {\n const [animationState, setAnimationState] = useState<AnimationState>({\n showPauseAnimation: false,\n showErrorAnimation: false,\n showPulsatingText: false,\n pulsatingFinished: false,\n showLabels: true,\n showMainText: true,\n showIdlePulsating: false,\n idleDotsCount: 0,\n })\n\n // Refs for managing timeouts and intervals\n const pauseAnimationTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const errorAnimationTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const pulsatingIntervalRef = useRef<NodeJS.Timeout | null>(null)\n const fadeTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const pulseCountRef = useRef<number>(0)\n const idlePulsatingIntervalRef = useRef<NodeJS.Timeout | null>(null)\n const idleDotsIntervalRef = useRef<NodeJS.Timeout | null>(null)\n\n const triggerPauseAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showPauseAnimation: true }))\n\n if (pauseAnimationTimeoutRef.current) {\n clearTimeout(pauseAnimationTimeoutRef.current)\n }\n\n pauseAnimationTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({ ...prev, showPauseAnimation: false }))\n }, 800)\n }, [])\n\n const triggerErrorAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: true }))\n\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n\n errorAnimationTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: false }))\n }, 600)\n }, [])\n\n const clearErrorAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: false }))\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n }, [])\n\n const startPulsatingAnimation = useCallback((onComplete?: () => void) => {\n pulseCountRef.current = 0\n // Start with fade to success color\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: true,\n pulsatingFinished: false,\n }))\n\n // After initial success color fade, start slow pulsating like idle\n setTimeout(() => {\n setAnimationState((prev) => ({\n ...prev,\n pulsatingFinished: true, // This will keep the success color and start slow pulsating\n }))\n\n // Start slow pulsating animation similar to idle\n pulsatingIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: !prev.showPulsatingText,\n }))\n }, 2000) // Same slow timing as idle pulsating\n\n if (onComplete) {\n onComplete()\n }\n }, 800) // Initial success color display duration\n }, [])\n\n const stopPulsatingAnimation = useCallback(() => {\n if (pulsatingIntervalRef.current) {\n clearInterval(pulsatingIntervalRef.current)\n pulsatingIntervalRef.current = null\n }\n // Reset all pulsating states to ensure colors are reset\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: false,\n pulsatingFinished: false,\n }))\n pulseCountRef.current = 0\n }, [])\n\n const startIdleAnimations = useCallback(() => {\n // Start pulsating animation for the text\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: true,\n }))\n\n idlePulsatingIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: !prev.showIdlePulsating,\n }))\n }, 2000) // Slower pulsate every 2 seconds\n\n // Start animated dots\n idleDotsIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n idleDotsCount: (prev.idleDotsCount + 1) % 4, // Cycle through 0, 1, 2, 3\n }))\n }, 800) // Change dots every 800ms\n }, [])\n\n const stopIdleAnimations = useCallback(() => {\n if (idlePulsatingIntervalRef.current) {\n clearInterval(idlePulsatingIntervalRef.current)\n idlePulsatingIntervalRef.current = null\n }\n if (idleDotsIntervalRef.current) {\n clearInterval(idleDotsIntervalRef.current)\n idleDotsIntervalRef.current = null\n }\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: false,\n idleDotsCount: 0,\n }))\n }, [])\n\n const triggerFadeTransition = useCallback(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: false,\n showMainText: false,\n }))\n\n if (fadeTimeoutRef.current) {\n clearTimeout(fadeTimeoutRef.current)\n }\n\n fadeTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: true,\n showMainText: true,\n }))\n }, 200)\n }, [])\n\n const setInitialAnimationState = useCallback(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: true,\n showMainText: true,\n }))\n }, [])\n\n // Cleanup function\n const cleanup = useCallback(() => {\n if (pauseAnimationTimeoutRef.current) {\n clearTimeout(pauseAnimationTimeoutRef.current)\n }\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n if (fadeTimeoutRef.current) {\n clearTimeout(fadeTimeoutRef.current)\n }\n if (pulsatingIntervalRef.current) {\n clearInterval(pulsatingIntervalRef.current)\n }\n if (idlePulsatingIntervalRef.current) {\n clearInterval(idlePulsatingIntervalRef.current)\n }\n if (idleDotsIntervalRef.current) {\n clearInterval(idleDotsIntervalRef.current)\n }\n }, [])\n\n return {\n animationState,\n triggerPauseAnimation,\n triggerErrorAnimation,\n clearErrorAnimation,\n startPulsatingAnimation,\n stopPulsatingAnimation,\n startIdleAnimations,\n stopIdleAnimations,\n triggerFadeTransition,\n setInitialAnimationState,\n cleanup,\n }\n}\n"],"names":["useAnimations","animationState","setAnimationState","useState","pauseAnimationTimeoutRef","useRef","errorAnimationTimeoutRef","pulsatingIntervalRef","fadeTimeoutRef","pulseCountRef","idlePulsatingIntervalRef","idleDotsIntervalRef","triggerPauseAnimation","useCallback","prev","triggerErrorAnimation","clearErrorAnimation","startPulsatingAnimation","onComplete","stopPulsatingAnimation","startIdleAnimations","stopIdleAnimations","triggerFadeTransition","setInitialAnimationState","cleanup"],"mappings":"yGAGaA,EAAgB,IAAM,CACjC,KAAM,CAACC,EAAgBC,CAAiB,EAAIC,WAAyB,CACnE,mBAAoB,GACpB,mBAAoB,GACpB,kBAAmB,GACnB,kBAAmB,GACnB,WAAY,GACZ,aAAc,GACd,kBAAmB,GACnB,cAAe,CAAA,CAChB,EAGKC,EAA2BC,EAAAA,OAA8B,IAAI,EAC7DC,EAA2BD,EAAAA,OAA8B,IAAI,EAC7DE,EAAuBF,EAAAA,OAA8B,IAAI,EACzDG,EAAiBH,EAAAA,OAA8B,IAAI,EACnDI,EAAgBJ,EAAAA,OAAe,CAAC,EAChCK,EAA2BL,EAAAA,OAA8B,IAAI,EAC7DM,EAAsBN,EAAAA,OAA8B,IAAI,EAExDO,EAAwBC,EAAAA,YAAY,IAAM,CAC9CX,EAAmBY,IAAU,CAAE,GAAGA,EAAM,mBAAoB,IAAO,EAE/DV,EAAyB,SAC3B,aAAaA,EAAyB,OAAO,EAG/CA,EAAyB,QAAU,WAAW,IAAM,CAClDF,EAAmBY,IAAU,CAAE,GAAGA,EAAM,mBAAoB,IAAQ,CACtE,EAAG,GAAG,CACR,EAAG,CAAA,CAAE,EAECC,EAAwBF,EAAAA,YAAY,IAAM,CAC9CX,EAAmBY,IAAU,CAAE,GAAGA,EAAM,mBAAoB,IAAO,EAE/DR,EAAyB,SAC3B,aAAaA,EAAyB,OAAO,EAG/CA,EAAyB,QAAU,WAAW,IAAM,CAClDJ,EAAmBY,IAAU,CAAE,GAAGA,EAAM,mBAAoB,IAAQ,CACtE,EAAG,GAAG,CACR,EAAG,CAAA,CAAE,EAECE,EAAsBH,EAAAA,YAAY,IAAM,CAC5CX,EAAmBY,IAAU,CAAE,GAAGA,EAAM,mBAAoB,IAAQ,EAChER,EAAyB,SAC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A,EACH,kBAAmB,GACnB,cAAe,CAAA,EACf,CACJ,EAAG,CAAA,CAAE,EAECQ,EAAwBT,EAAAA,YAAY,IAAM,CAC9CX,EAAmBY,IAAU,CAC3B,GAAGA,EACH,WAAY,GACZ,aAAc,EAAA,EACd,EAEEN,EAAe,SACjB,aAAaA,EAAe,OAAO,EAGrCA,EAAe,QAAU,WAAW,IAAM,CACxCN,EAAmBY,IAAU,CAC3B,GAAGA,EACH,WAAY,GACZ,aAAc,EAAA,EACd,CACJ,EAAG,GAAG,CACR,EAAG,CAAA,CAAE,EAECS,EAA2BV,EAAAA,YAAY,IAAM,CACjDX,EAAmBY,IAAU,CAC3B,GAAGA,EACH,WAAY,GACZ,aAAc,EAAA,EACd,CACJ,EAAG,CAAA,CAAE,EAGCU,EAAUX,EAAAA,YAAY,IAAM,CAC5BT,EAAyB,SAC3B,aAAaA,EAAyB,OAAO,EAE3CE,EAAyB,SAC3B,aAAaA,EAAyB,OAAO,EAE3CE,EAAe,SACjB,aAAaA,EAAe,OAAO,EAEjCD,EAAqB,SACvB,cAAcA,EAAqB,OAAO,EAExCG,EAAyB,SAC3B,cAAcA,EAAyB,OAAO,EAE5CC,EAAoB,SACtB,cAAcA,EAAoB,OAAO,CAE7C,EAAG,CAAA,CAAE,EAEL,MAAO,CACL,eAAAV,EACA,sBAAAW,EACA,sBAAAG,EACA,oBAAAC,EACA,wBAAAC,EACA,uBAAAE,EACA,oBAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,QAAAC,CAAA,CAEJ"}
@@ -0,0 +1,105 @@
1
+ import { useState as p, useRef as s, useCallback as n } from "react";
2
+ const E = () => {
3
+ const [m, e] = p({
4
+ showPauseAnimation: !1,
5
+ showErrorAnimation: !1,
6
+ showPulsatingText: !1,
7
+ pulsatingFinished: !1,
8
+ showLabels: !0,
9
+ showMainText: !0,
10
+ showIdlePulsating: !1,
11
+ idleDotsCount: 0
12
+ }), l = s(null), r = s(null), i = s(null), c = s(null), f = s(0), u = s(null), a = s(null), h = n(() => {
13
+ e((t) => ({ ...t, showPauseAnimation: !0 })), l.current && clearTimeout(l.current), l.current = setTimeout(() => {
14
+ e((t) => ({ ...t, showPauseAnimation: !1 }));
15
+ }, 800);
16
+ }, []), w = n(() => {
17
+ e((t) => ({ ...t, showErrorAnimation: !0 })), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
18
+ e((t) => ({ ...t, showErrorAnimation: !1 }));
19
+ }, 600);
20
+ }, []), g = n(() => {
21
+ e((t) => ({ ...t, showErrorAnimation: !1 })), r.current && clearTimeout(r.current);
22
+ }, []), T = n((t) => {
23
+ f.current = 0, e((o) => ({
24
+ ...o,
25
+ showPulsatingText: !0,
26
+ pulsatingFinished: !1
27
+ })), setTimeout(() => {
28
+ e((o) => ({
29
+ ...o,
30
+ pulsatingFinished: !0
31
+ // This will keep the success color and start slow pulsating
32
+ })), i.current = setInterval(() => {
33
+ e((o) => ({
34
+ ...o,
35
+ showPulsatingText: !o.showPulsatingText
36
+ }));
37
+ }, 2e3), t && t();
38
+ }, 800);
39
+ }, []), I = n(() => {
40
+ i.current && (clearInterval(i.current), i.current = null), e((t) => ({
41
+ ...t,
42
+ showPulsatingText: !1,
43
+ pulsatingFinished: !1
44
+ })), f.current = 0;
45
+ }, []), d = n(() => {
46
+ e((t) => ({
47
+ ...t,
48
+ showIdlePulsating: !0
49
+ })), u.current = setInterval(() => {
50
+ e((t) => ({
51
+ ...t,
52
+ showIdlePulsating: !t.showIdlePulsating
53
+ }));
54
+ }, 2e3), a.current = setInterval(() => {
55
+ e((t) => ({
56
+ ...t,
57
+ idleDotsCount: (t.idleDotsCount + 1) % 4
58
+ // Cycle through 0, 1, 2, 3
59
+ }));
60
+ }, 800);
61
+ }, []), A = n(() => {
62
+ u.current && (clearInterval(u.current), u.current = null), a.current && (clearInterval(a.current), a.current = null), e((t) => ({
63
+ ...t,
64
+ showIdlePulsating: !1,
65
+ idleDotsCount: 0
66
+ }));
67
+ }, []), P = n(() => {
68
+ e((t) => ({
69
+ ...t,
70
+ showLabels: !1,
71
+ showMainText: !1
72
+ })), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
73
+ e((t) => ({
74
+ ...t,
75
+ showLabels: !0,
76
+ showMainText: !0
77
+ }));
78
+ }, 200);
79
+ }, []), x = n(() => {
80
+ e((t) => ({
81
+ ...t,
82
+ showLabels: !0,
83
+ showMainText: !0
84
+ }));
85
+ }, []), v = n(() => {
86
+ l.current && clearTimeout(l.current), r.current && clearTimeout(r.current), c.current && clearTimeout(c.current), i.current && clearInterval(i.current), u.current && clearInterval(u.current), a.current && clearInterval(a.current);
87
+ }, []);
88
+ return {
89
+ animationState: m,
90
+ triggerPauseAnimation: h,
91
+ triggerErrorAnimation: w,
92
+ clearErrorAnimation: g,
93
+ startPulsatingAnimation: T,
94
+ stopPulsatingAnimation: I,
95
+ startIdleAnimations: d,
96
+ stopIdleAnimations: A,
97
+ triggerFadeTransition: P,
98
+ setInitialAnimationState: x,
99
+ cleanup: v
100
+ };
101
+ };
102
+ export {
103
+ E as useAnimations
104
+ };
105
+ //# sourceMappingURL=useAnimations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimations.js","sources":["../../../src/components/CycleTimer/useAnimations.ts"],"sourcesContent":["import { useCallback, useRef, useState } from \"react\"\nimport type { AnimationState } from \"./types\"\n\nexport const useAnimations = () => {\n const [animationState, setAnimationState] = useState<AnimationState>({\n showPauseAnimation: false,\n showErrorAnimation: false,\n showPulsatingText: false,\n pulsatingFinished: false,\n showLabels: true,\n showMainText: true,\n showIdlePulsating: false,\n idleDotsCount: 0,\n })\n\n // Refs for managing timeouts and intervals\n const pauseAnimationTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const errorAnimationTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const pulsatingIntervalRef = useRef<NodeJS.Timeout | null>(null)\n const fadeTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n const pulseCountRef = useRef<number>(0)\n const idlePulsatingIntervalRef = useRef<NodeJS.Timeout | null>(null)\n const idleDotsIntervalRef = useRef<NodeJS.Timeout | null>(null)\n\n const triggerPauseAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showPauseAnimation: true }))\n\n if (pauseAnimationTimeoutRef.current) {\n clearTimeout(pauseAnimationTimeoutRef.current)\n }\n\n pauseAnimationTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({ ...prev, showPauseAnimation: false }))\n }, 800)\n }, [])\n\n const triggerErrorAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: true }))\n\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n\n errorAnimationTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: false }))\n }, 600)\n }, [])\n\n const clearErrorAnimation = useCallback(() => {\n setAnimationState((prev) => ({ ...prev, showErrorAnimation: false }))\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n }, [])\n\n const startPulsatingAnimation = useCallback((onComplete?: () => void) => {\n pulseCountRef.current = 0\n // Start with fade to success color\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: true,\n pulsatingFinished: false,\n }))\n\n // After initial success color fade, start slow pulsating like idle\n setTimeout(() => {\n setAnimationState((prev) => ({\n ...prev,\n pulsatingFinished: true, // This will keep the success color and start slow pulsating\n }))\n\n // Start slow pulsating animation similar to idle\n pulsatingIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: !prev.showPulsatingText,\n }))\n }, 2000) // Same slow timing as idle pulsating\n\n if (onComplete) {\n onComplete()\n }\n }, 800) // Initial success color display duration\n }, [])\n\n const stopPulsatingAnimation = useCallback(() => {\n if (pulsatingIntervalRef.current) {\n clearInterval(pulsatingIntervalRef.current)\n pulsatingIntervalRef.current = null\n }\n // Reset all pulsating states to ensure colors are reset\n setAnimationState((prev) => ({\n ...prev,\n showPulsatingText: false,\n pulsatingFinished: false,\n }))\n pulseCountRef.current = 0\n }, [])\n\n const startIdleAnimations = useCallback(() => {\n // Start pulsating animation for the text\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: true,\n }))\n\n idlePulsatingIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: !prev.showIdlePulsating,\n }))\n }, 2000) // Slower pulsate every 2 seconds\n\n // Start animated dots\n idleDotsIntervalRef.current = setInterval(() => {\n setAnimationState((prev) => ({\n ...prev,\n idleDotsCount: (prev.idleDotsCount + 1) % 4, // Cycle through 0, 1, 2, 3\n }))\n }, 800) // Change dots every 800ms\n }, [])\n\n const stopIdleAnimations = useCallback(() => {\n if (idlePulsatingIntervalRef.current) {\n clearInterval(idlePulsatingIntervalRef.current)\n idlePulsatingIntervalRef.current = null\n }\n if (idleDotsIntervalRef.current) {\n clearInterval(idleDotsIntervalRef.current)\n idleDotsIntervalRef.current = null\n }\n setAnimationState((prev) => ({\n ...prev,\n showIdlePulsating: false,\n idleDotsCount: 0,\n }))\n }, [])\n\n const triggerFadeTransition = useCallback(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: false,\n showMainText: false,\n }))\n\n if (fadeTimeoutRef.current) {\n clearTimeout(fadeTimeoutRef.current)\n }\n\n fadeTimeoutRef.current = setTimeout(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: true,\n showMainText: true,\n }))\n }, 200)\n }, [])\n\n const setInitialAnimationState = useCallback(() => {\n setAnimationState((prev) => ({\n ...prev,\n showLabels: true,\n showMainText: true,\n }))\n }, [])\n\n // Cleanup function\n const cleanup = useCallback(() => {\n if (pauseAnimationTimeoutRef.current) {\n clearTimeout(pauseAnimationTimeoutRef.current)\n }\n if (errorAnimationTimeoutRef.current) {\n clearTimeout(errorAnimationTimeoutRef.current)\n }\n if (fadeTimeoutRef.current) {\n clearTimeout(fadeTimeoutRef.current)\n }\n if (pulsatingIntervalRef.current) {\n clearInterval(pulsatingIntervalRef.current)\n }\n if (idlePulsatingIntervalRef.current) {\n clearInterval(idlePulsatingIntervalRef.current)\n }\n if (idleDotsIntervalRef.current) {\n clearInterval(idleDotsIntervalRef.current)\n }\n }, [])\n\n return {\n animationState,\n triggerPauseAnimation,\n triggerErrorAnimation,\n clearErrorAnimation,\n startPulsatingAnimation,\n stopPulsatingAnimation,\n startIdleAnimations,\n stopIdleAnimations,\n triggerFadeTransition,\n setInitialAnimationState,\n cleanup,\n }\n}\n"],"names":["useAnimations","animationState","setAnimationState","useState","pauseAnimationTimeoutRef","useRef","errorAnimationTimeoutRef","pulsatingIntervalRef","fadeTimeoutRef","pulseCountRef","idlePulsatingIntervalRef","idleDotsIntervalRef","triggerPauseAnimation","useCallback","prev","triggerErrorAnimation","clearErrorAnimation","startPulsatingAnimation","onComplete","stopPulsatingAnimation","startIdleAnimations","stopIdleAnimations","triggerFadeTransition","setInitialAnimationState","cleanup"],"mappings":";AAGO,MAAMA,IAAgB,MAAM;AACjC,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAyB;AAAA,IACnE,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,eAAe;AAAA,EAAA,CAChB,GAGKC,IAA2BC,EAA8B,IAAI,GAC7DC,IAA2BD,EAA8B,IAAI,GAC7DE,IAAuBF,EAA8B,IAAI,GACzDG,IAAiBH,EAA8B,IAAI,GACnDI,IAAgBJ,EAAe,CAAC,GAChCK,IAA2BL,EAA8B,IAAI,GAC7DM,IAAsBN,EAA8B,IAAI,GAExDO,IAAwBC,EAAY,MAAM;AAC9C,IAAAX,EAAkB,CAACY,OAAU,EAAE,GAAGA,GAAM,oBAAoB,KAAO,GAE/DV,EAAyB,WAC3B,aAAaA,EAAyB,OAAO,GAG/CA,EAAyB,UAAU,WAAW,MAAM;AAClD,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CAAA,CAAE,GAECS,IAA2BV,EAAY,MAAM;AACjD,IAAAX,EAAkB,CAACY,OAAU;AAAA,MAC3B,GAAGA;AAAA,MACH,YAAY;AAAA,MACZ,cAAc;AAAA,IAAA,EACd;AAAA,EACJ,GAAG,CAAA,CAAE,GAGCU,IAAUX,EAAY,MAAM;AAChC,IAAIT,EAAyB,WAC3B,aAAaA,EAAyB,OAAO,GAE3CE,EAAyB,WAC3B,aAAaA,EAAyB,OAAO,GAE3CE,EAAe,WACjB,aAAaA,EAAe,OAAO,GAEjCD,EAAqB,WACvB,cAAcA,EAAqB,OAAO,GAExCG,EAAyB,WAC3B,cAAcA,EAAyB,OAAO,GAE5CC,EAAoB,WACtB,cAAcA,EAAoB,OAAO;AAAA,EAE7C,GAAG,CAAA,CAAE;AAEL,SAAO;AAAA,IACL,gBAAAV;AAAA,IACA,uBAAAW;AAAA,IACA,uBAAAG;AAAA,IACA,qBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,wBAAAE;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,SAAAC;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),h=require("../utils/interpolation.cjs"),A=require("./utils.cjs"),B=({autoStart:g,onCycleEnd:m,onMeasuringComplete:R,hasError:d,onPauseAnimation:w,onErrorAnimation:x,onClearErrorAnimation:p,onStartPulsating:b})=>{const[e,n]=a.useState({currentState:"idle",remainingTime:0,maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),o=a.useRef(null),i=a.useRef(null),f=a.useRef(0),[s]=h.useInterpolation([0],{tension:80,friction:18,onChange:([t])=>{n(r=>({...r,currentProgress:t}))}}),k=a.useCallback(()=>{n(t=>({...t,currentState:"idle",maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0})),f.current=0,i.current=null,s.setImmediate([0])},[s]),q=a.useCallback((t=0)=>{const r=t/60%1*100;n(u=>({...u,currentState:"measuring",maxTime:null,remainingTime:t,isPausedState:!1,currentProgress:r})),f.current=0,s.setImmediate([r]),g?(i.current=Date.now()-t*1e3,n(u=>({...u,isRunning:!0}))):i.current=null},[g,s]),I=a.useCallback((t,r=0)=>{n(c=>({...c,isRunning:!1})),i.current=null,n(c=>({...c,currentState:"countdown",maxTime:t,isPausedState:!1})),f.current=0;const u=Math.max(0,t-r),l=r>0?r/t*100:0;n(c=>({...c,remainingTime:u,currentProgress:l})),s.setImmediate([l]),u===0?(n(c=>({...c,isRunning:!1})),i.current=null,m&&queueMicrotask(()=>m())):g?setTimeout(()=>{i.current=Date.now()-r*1e3,n(c=>({...c,isRunning:!0}))},0):i.current=null},[g,m,s]),M=a.useCallback(()=>{n(t=>({...t,isRunning:!1,currentState:"measured"})),i.current=null,b(()=>{R&&R()})},[b,R]),T=a.useCallback(()=>{if(i.current&&e.isRunning){const r=Date.now()-i.current;f.current+=r;const u=f.current/1e3,l=A.calculateExactProgress(e.currentState,u,e.maxTime);s.setTarget([l])}n(t=>({...t,isRunning:!1,isPausedState:!0})),w()},[e.isRunning,e.currentState,e.maxTime,s,w]),P=a.useCallback(()=>{e.isPausedState&&(e.remainingTime>0||e.currentState!=="countdown")&&(i.current=Date.now(),n(t=>({...t,isRunning:!0,isPausedState:!1})))},[e.isPausedState,e.remainingTime,e.currentState]),F=a.useCallback(()=>e.isPausedState,[e.isPausedState]);return a.useEffect(()=>{d?(e.isRunning&&!e.isPausedState&&(n(t=>({...t,wasRunningBeforeError:!0})),T()),x()):(e.wasRunningBeforeError&&e.isPausedState&&(n(t=>({...t,wasRunningBeforeError:!1})),P()),p())},[d,e.isRunning,e.isPausedState,e.wasRunningBeforeError,T,P,x,p]),a.useEffect(()=>{if(e.isRunning){const t=()=>{if(i.current){const u=(Date.now()-i.current+f.current)/1e3;if(e.currentState==="countdown"&&e.maxTime!==null){const l=Math.max(0,e.maxTime-u);n(S=>({...S,remainingTime:Math.ceil(l)}));const c=Math.min(100,u/e.maxTime*100);if(s.setTarget([c]),l<=0){n(S=>({...S,isRunning:!1,remainingTime:0})),i.current=null,s.setTarget([100]),m&&queueMicrotask(()=>m());return}}else if(e.currentState==="measuring"){n(c=>({...c,remainingTime:Math.floor(u)}));const l=u/60%1*100;s.setTarget([l])}e.isRunning&&(o.current=requestAnimationFrame(t))}};o.current=requestAnimationFrame(t)}else o.current&&(cancelAnimationFrame(o.current),o.current=null);return()=>{o.current&&cancelAnimationFrame(o.current)}},[e.isRunning,m,e.currentState,e.maxTime,s]),a.useEffect(()=>{let t=null;const r=()=>{s.update(1/60),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),()=>{t&&cancelAnimationFrame(t)}},[s]),{timerState:e,controls:{startNewCycle:I,startMeasuring:q,setIdle:k,completeMeasuring:M,pause:T,resume:P,isPaused:F}}};exports.useTimerLogic=B;
2
+ //# sourceMappingURL=useTimerLogic.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTimerLogic.cjs","sources":["../../../src/components/CycleTimer/useTimerLogic.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useInterpolation } from \"../utils/interpolation\"\nimport type { TimerState } from \"./types\"\nimport { calculateExactProgress } from \"./utils\"\n\ninterface UseTimerLogicProps {\n autoStart: boolean\n onCycleEnd?: () => void\n onMeasuringComplete?: () => void\n hasError: boolean\n onPauseAnimation: () => void\n onErrorAnimation: () => void\n onClearErrorAnimation: () => void\n onStartPulsating: (onComplete?: () => void) => void\n}\n\nexport const useTimerLogic = ({\n autoStart,\n onCycleEnd,\n onMeasuringComplete,\n hasError,\n onPauseAnimation,\n onErrorAnimation,\n onClearErrorAnimation,\n onStartPulsating,\n}: UseTimerLogicProps) => {\n const [timerState, setTimerState] = useState<TimerState>({\n currentState: \"idle\",\n remainingTime: 0,\n maxTime: null,\n isRunning: false,\n isPausedState: false,\n currentProgress: 0,\n wasRunningBeforeError: false,\n })\n\n // Timer-related refs\n const animationRef = useRef<number | null>(null)\n const startTimeRef = useRef<number | null>(null)\n const pausedTimeRef = useRef<number>(0)\n\n // Spring-based interpolator for smooth gauge progress animations\n const [progressInterpolator] = useInterpolation([0], {\n tension: 80,\n friction: 18,\n onChange: ([progress]) => {\n setTimerState((prev) => ({ ...prev, currentProgress: progress }))\n },\n })\n\n const setIdle = useCallback(() => {\n setTimerState((prev) => ({\n ...prev,\n currentState: \"idle\",\n maxTime: null,\n // Don't reset remainingTime - keep the last value\n isRunning: false,\n isPausedState: false,\n currentProgress: 0, // Reset progress to 0 for gauge\n }))\n pausedTimeRef.current = 0\n startTimeRef.current = null\n progressInterpolator.setImmediate([0]) // Use setImmediate for instant reset\n }, [progressInterpolator])\n\n const startMeasuring = useCallback(\n (elapsedSeconds: number = 0) => {\n const initialProgress = ((elapsedSeconds / 60) % 1) * 100\n setTimerState((prev) => ({\n ...prev,\n currentState: \"measuring\",\n maxTime: null,\n remainingTime: elapsedSeconds,\n isPausedState: false,\n currentProgress: initialProgress, // Immediately set progress\n }))\n pausedTimeRef.current = 0\n\n progressInterpolator.setImmediate([initialProgress]) // Use setImmediate for instant reset\n\n if (autoStart) {\n startTimeRef.current = Date.now() - elapsedSeconds * 1000\n setTimerState((prev) => ({ ...prev, isRunning: true }))\n } else {\n startTimeRef.current = null\n }\n },\n [autoStart, progressInterpolator],\n )\n\n const startNewCycle = useCallback(\n (maxTimeSeconds: number, elapsedSeconds: number = 0) => {\n // Stop any running timer first to prevent conflicts\n setTimerState((prev) => ({ ...prev, isRunning: false }))\n startTimeRef.current = null\n\n setTimerState((prev) => ({\n ...prev,\n currentState: \"countdown\",\n maxTime: maxTimeSeconds,\n isPausedState: false,\n }))\n pausedTimeRef.current = 0\n\n // Count-down mode\n const remainingSeconds = Math.max(0, maxTimeSeconds - elapsedSeconds)\n const initialProgress =\n elapsedSeconds > 0 ? (elapsedSeconds / maxTimeSeconds) * 100 : 0\n\n setTimerState((prev) => ({\n ...prev,\n remainingTime: remainingSeconds,\n currentProgress: initialProgress, // Immediately set progress\n }))\n\n progressInterpolator.setImmediate([initialProgress]) // Use setImmediate for instant reset\n\n if (remainingSeconds === 0) {\n setTimerState((prev) => ({ ...prev, isRunning: false }))\n startTimeRef.current = null\n if (onCycleEnd) {\n queueMicrotask(() => onCycleEnd())\n }\n } else if (autoStart) {\n setTimeout(() => {\n startTimeRef.current = Date.now() - elapsedSeconds * 1000\n setTimerState((prev) => ({ ...prev, isRunning: true }))\n }, 0)\n } else {\n startTimeRef.current = null\n }\n },\n [autoStart, onCycleEnd, progressInterpolator],\n )\n\n const completeMeasuring = useCallback(() => {\n // Always trigger completion regardless of current state\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n currentState: \"measured\",\n }))\n startTimeRef.current = null\n\n onStartPulsating(() => {\n if (onMeasuringComplete) {\n onMeasuringComplete()\n }\n })\n }, [onStartPulsating, onMeasuringComplete])\n\n const pause = useCallback(() => {\n if (startTimeRef.current && timerState.isRunning) {\n const now = Date.now()\n const additionalElapsed = now - startTimeRef.current\n pausedTimeRef.current += additionalElapsed\n\n const totalElapsed = pausedTimeRef.current / 1000\n const exactProgress = calculateExactProgress(\n timerState.currentState,\n totalElapsed,\n timerState.maxTime,\n )\n progressInterpolator.setTarget([exactProgress])\n }\n\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n isPausedState: true,\n }))\n onPauseAnimation()\n }, [\n timerState.isRunning,\n timerState.currentState,\n timerState.maxTime,\n progressInterpolator,\n onPauseAnimation,\n ])\n\n const resume = useCallback(() => {\n if (\n timerState.isPausedState &&\n (timerState.remainingTime > 0 || timerState.currentState !== \"countdown\")\n ) {\n startTimeRef.current = Date.now()\n setTimerState((prev) => ({\n ...prev,\n isRunning: true,\n isPausedState: false,\n }))\n }\n }, [\n timerState.isPausedState,\n timerState.remainingTime,\n timerState.currentState,\n ])\n\n const isPaused = useCallback(() => {\n return timerState.isPausedState\n }, [timerState.isPausedState])\n\n // Handle error state changes\n useEffect(() => {\n if (hasError) {\n if (timerState.isRunning && !timerState.isPausedState) {\n setTimerState((prev) => ({ ...prev, wasRunningBeforeError: true }))\n pause()\n }\n onErrorAnimation()\n } else {\n if (timerState.wasRunningBeforeError && timerState.isPausedState) {\n setTimerState((prev) => ({ ...prev, wasRunningBeforeError: false }))\n resume()\n }\n onClearErrorAnimation()\n }\n }, [\n hasError,\n timerState.isRunning,\n timerState.isPausedState,\n timerState.wasRunningBeforeError,\n pause,\n resume,\n onErrorAnimation,\n onClearErrorAnimation,\n ])\n\n // Main timer loop\n useEffect(() => {\n if (timerState.isRunning) {\n const updateTimer = () => {\n if (startTimeRef.current) {\n const now = Date.now()\n const elapsed =\n (now - startTimeRef.current + pausedTimeRef.current) / 1000\n\n if (\n timerState.currentState === \"countdown\" &&\n timerState.maxTime !== null\n ) {\n const remaining = Math.max(0, timerState.maxTime - elapsed)\n setTimerState((prev) => ({\n ...prev,\n remainingTime: Math.ceil(remaining),\n }))\n\n const progress = Math.min(100, (elapsed / timerState.maxTime) * 100)\n progressInterpolator.setTarget([progress])\n\n if (remaining <= 0) {\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n remainingTime: 0,\n }))\n startTimeRef.current = null\n progressInterpolator.setTarget([100])\n if (onCycleEnd) {\n queueMicrotask(() => onCycleEnd())\n }\n return\n }\n } else if (timerState.currentState === \"measuring\") {\n setTimerState((prev) => ({\n ...prev,\n remainingTime: Math.floor(elapsed),\n }))\n const progress = ((elapsed / 60) % 1) * 100\n progressInterpolator.setTarget([progress])\n }\n\n if (timerState.isRunning) {\n animationRef.current = requestAnimationFrame(updateTimer)\n }\n }\n }\n\n animationRef.current = requestAnimationFrame(updateTimer)\n } else {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n }\n\n return () => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n }\n }\n }, [\n timerState.isRunning,\n onCycleEnd,\n timerState.currentState,\n timerState.maxTime,\n progressInterpolator,\n ])\n\n // Interpolation animation loop\n useEffect(() => {\n let interpolationAnimationId: number | null = null\n\n const animateInterpolation = () => {\n progressInterpolator.update(1 / 60)\n interpolationAnimationId = requestAnimationFrame(animateInterpolation)\n }\n\n interpolationAnimationId = requestAnimationFrame(animateInterpolation)\n\n return () => {\n if (interpolationAnimationId) {\n cancelAnimationFrame(interpolationAnimationId)\n }\n }\n }, [progressInterpolator])\n\n return {\n timerState,\n controls: {\n startNewCycle,\n startMeasuring,\n setIdle,\n completeMeasuring,\n pause,\n resume,\n isPaused,\n },\n }\n}\n"],"names":["useTimerLogic","autoStart","onCycleEnd","onMeasuringComplete","hasError","onPauseAnimation","onErrorAnimation","onClearErrorAnimation","onStartPulsating","timerState","setTimerState","useState","animationRef","useRef","startTimeRef","pausedTimeRef","progressInterpolator","useInterpolation","progress","prev","setIdle","useCallback","startMeasuring","elapsedSeconds","initialProgress","startNewCycle","maxTimeSeconds","remainingSeconds","completeMeasuring","pause","additionalElapsed","totalElapsed","exactProgress","calculateExactProgress","resume","isPaused","useEffect","updateTimer","elapsed","remaining","interpolationAnimationId","animateInterpolation"],"mappings":"0KAgBaA,EAAgB,CAAC,CAC5B,UAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,sBAAAC,EACA,iBAAAC,CACF,IAA0B,CACxB,KAAM,CAACC,EAAYC,CAAa,EAAIC,WAAqB,CACvD,aAAc,OACd,cAAe,EACf,QAAS,KACT,UAAW,GACX,cAAe,GACf,gBAAiB,EACjB,sBAAuB,EAAA,CACxB,EAGKC,EAAeC,EAAAA,OAAsB,IAAI,EACzCC,EAAeD,EAAAA,OAAsB,IAAI,EACzCE,EAAgBF,EAAAA,OAAe,CAAC,EAGhC,CAACG,CAAoB,EAAIC,mBAAiB,CAAC,CAAC,EAAG,CACnD,QAAS,GACT,SAAU,GACV,SAAU,CAAC,CAACC,CAAQ,IAAM,CACxBR,EAAeS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C,CAEIT,EAAW,YACbG,EAAa,QAAU,sBAAsByB,CAAW,EAE5D,CACF,EAEAzB,EAAa,QAAU,sBAAsByB,CAAW,CAC1D,MACMzB,EAAa,UACf,qBAAqBA,EAAa,OAAO,EACzCA,EAAa,QAAU,MAI3B,MAAO,IAAM,CACPA,EAAa,SACf,qBAAqBA,EAAa,OAAO,CAE7C,CACF,EAAG,CACDH,EAAW,UACXP,EACAO,EAAW,aACXA,EAAW,QACXO,CAAA,CACD,EAGDoB,EAAAA,UAAU,IAAM,CACd,IAAII,EAA0C,KAE9C,MAAMC,EAAuB,IAAM,CACjCzB,EAAqB,OAAO,EAAI,EAAE,EAClCwB,EAA2B,sBAAsBC,CAAoB,CACvE,EAEA,OAAAD,EAA2B,sBAAsBC,CAAoB,EAE9D,IAAM,CACPD,GACF,qBAAqBA,CAAwB,CAEjD,CACF,EAAG,CAACxB,CAAoB,CAAC,EAElB,CACL,WAAAP,EACA,SAAU,CACR,cAAAgB,EACA,eAAAH,EACA,QAAAF,EACA,kBAAAQ,EACA,MAAAC,EACA,OAAAK,EACA,SAAAC,CAAA,CACF,CAEJ"}
@@ -0,0 +1,191 @@
1
+ import { useState as k, useRef as S, useCallback as m, useEffect as d } from "react";
2
+ import { useInterpolation as b } from "../utils/interpolation.js";
3
+ import { calculateExactProgress as E } from "./utils.js";
4
+ const v = ({
5
+ autoStart: f,
6
+ onCycleEnd: l,
7
+ onMeasuringComplete: R,
8
+ hasError: x,
9
+ onPauseAnimation: p,
10
+ onErrorAnimation: I,
11
+ onClearErrorAnimation: F,
12
+ onStartPulsating: M
13
+ }) => {
14
+ const [e, t] = k({
15
+ currentState: "idle",
16
+ remainingTime: 0,
17
+ maxTime: null,
18
+ isRunning: !1,
19
+ isPausedState: !1,
20
+ currentProgress: 0,
21
+ wasRunningBeforeError: !1
22
+ }), o = S(null), i = S(null), g = S(0), [s] = b([0], {
23
+ tension: 80,
24
+ friction: 18,
25
+ onChange: ([n]) => {
26
+ t((r) => ({ ...r, currentProgress: n }));
27
+ }
28
+ }), q = m(() => {
29
+ t((n) => ({
30
+ ...n,
31
+ currentState: "idle",
32
+ maxTime: null,
33
+ // Don't reset remainingTime - keep the last value
34
+ isRunning: !1,
35
+ isPausedState: !1,
36
+ currentProgress: 0
37
+ // Reset progress to 0 for gauge
38
+ })), g.current = 0, i.current = null, s.setImmediate([0]);
39
+ }, [s]), h = m(
40
+ (n = 0) => {
41
+ const r = n / 60 % 1 * 100;
42
+ t((a) => ({
43
+ ...a,
44
+ currentState: "measuring",
45
+ maxTime: null,
46
+ remainingTime: n,
47
+ isPausedState: !1,
48
+ currentProgress: r
49
+ // Immediately set progress
50
+ })), g.current = 0, s.setImmediate([r]), f ? (i.current = Date.now() - n * 1e3, t((a) => ({ ...a, isRunning: !0 }))) : i.current = null;
51
+ },
52
+ [f, s]
53
+ ), A = m(
54
+ (n, r = 0) => {
55
+ t((u) => ({ ...u, isRunning: !1 })), i.current = null, t((u) => ({
56
+ ...u,
57
+ currentState: "countdown",
58
+ maxTime: n,
59
+ isPausedState: !1
60
+ })), g.current = 0;
61
+ const a = Math.max(0, n - r), c = r > 0 ? r / n * 100 : 0;
62
+ t((u) => ({
63
+ ...u,
64
+ remainingTime: a,
65
+ currentProgress: c
66
+ // Immediately set progress
67
+ })), s.setImmediate([c]), a === 0 ? (t((u) => ({ ...u, isRunning: !1 })), i.current = null, l && queueMicrotask(() => l())) : f ? setTimeout(() => {
68
+ i.current = Date.now() - r * 1e3, t((u) => ({ ...u, isRunning: !0 }));
69
+ }, 0) : i.current = null;
70
+ },
71
+ [f, l, s]
72
+ ), B = m(() => {
73
+ t((n) => ({
74
+ ...n,
75
+ isRunning: !1,
76
+ currentState: "measured"
77
+ })), i.current = null, M(() => {
78
+ R && R();
79
+ });
80
+ }, [M, R]), T = m(() => {
81
+ if (i.current && e.isRunning) {
82
+ const r = Date.now() - i.current;
83
+ g.current += r;
84
+ const a = g.current / 1e3, c = E(
85
+ e.currentState,
86
+ a,
87
+ e.maxTime
88
+ );
89
+ s.setTarget([c]);
90
+ }
91
+ t((n) => ({
92
+ ...n,
93
+ isRunning: !1,
94
+ isPausedState: !0
95
+ })), p();
96
+ }, [
97
+ e.isRunning,
98
+ e.currentState,
99
+ e.maxTime,
100
+ s,
101
+ p
102
+ ]), P = m(() => {
103
+ e.isPausedState && (e.remainingTime > 0 || e.currentState !== "countdown") && (i.current = Date.now(), t((n) => ({
104
+ ...n,
105
+ isRunning: !0,
106
+ isPausedState: !1
107
+ })));
108
+ }, [
109
+ e.isPausedState,
110
+ e.remainingTime,
111
+ e.currentState
112
+ ]), D = m(() => e.isPausedState, [e.isPausedState]);
113
+ return d(() => {
114
+ x ? (e.isRunning && !e.isPausedState && (t((n) => ({ ...n, wasRunningBeforeError: !0 })), T()), I()) : (e.wasRunningBeforeError && e.isPausedState && (t((n) => ({ ...n, wasRunningBeforeError: !1 })), P()), F());
115
+ }, [
116
+ x,
117
+ e.isRunning,
118
+ e.isPausedState,
119
+ e.wasRunningBeforeError,
120
+ T,
121
+ P,
122
+ I,
123
+ F
124
+ ]), d(() => {
125
+ if (e.isRunning) {
126
+ const n = () => {
127
+ if (i.current) {
128
+ const a = (Date.now() - i.current + g.current) / 1e3;
129
+ if (e.currentState === "countdown" && e.maxTime !== null) {
130
+ const c = Math.max(0, e.maxTime - a);
131
+ t((w) => ({
132
+ ...w,
133
+ remainingTime: Math.ceil(c)
134
+ }));
135
+ const u = Math.min(100, a / e.maxTime * 100);
136
+ if (s.setTarget([u]), c <= 0) {
137
+ t((w) => ({
138
+ ...w,
139
+ isRunning: !1,
140
+ remainingTime: 0
141
+ })), i.current = null, s.setTarget([100]), l && queueMicrotask(() => l());
142
+ return;
143
+ }
144
+ } else if (e.currentState === "measuring") {
145
+ t((u) => ({
146
+ ...u,
147
+ remainingTime: Math.floor(a)
148
+ }));
149
+ const c = a / 60 % 1 * 100;
150
+ s.setTarget([c]);
151
+ }
152
+ e.isRunning && (o.current = requestAnimationFrame(n));
153
+ }
154
+ };
155
+ o.current = requestAnimationFrame(n);
156
+ } else
157
+ o.current && (cancelAnimationFrame(o.current), o.current = null);
158
+ return () => {
159
+ o.current && cancelAnimationFrame(o.current);
160
+ };
161
+ }, [
162
+ e.isRunning,
163
+ l,
164
+ e.currentState,
165
+ e.maxTime,
166
+ s
167
+ ]), d(() => {
168
+ let n = null;
169
+ const r = () => {
170
+ s.update(1 / 60), n = requestAnimationFrame(r);
171
+ };
172
+ return n = requestAnimationFrame(r), () => {
173
+ n && cancelAnimationFrame(n);
174
+ };
175
+ }, [s]), {
176
+ timerState: e,
177
+ controls: {
178
+ startNewCycle: A,
179
+ startMeasuring: h,
180
+ setIdle: q,
181
+ completeMeasuring: B,
182
+ pause: T,
183
+ resume: P,
184
+ isPaused: D
185
+ }
186
+ };
187
+ };
188
+ export {
189
+ v as useTimerLogic
190
+ };
191
+ //# sourceMappingURL=useTimerLogic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTimerLogic.js","sources":["../../../src/components/CycleTimer/useTimerLogic.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useInterpolation } from \"../utils/interpolation\"\nimport type { TimerState } from \"./types\"\nimport { calculateExactProgress } from \"./utils\"\n\ninterface UseTimerLogicProps {\n autoStart: boolean\n onCycleEnd?: () => void\n onMeasuringComplete?: () => void\n hasError: boolean\n onPauseAnimation: () => void\n onErrorAnimation: () => void\n onClearErrorAnimation: () => void\n onStartPulsating: (onComplete?: () => void) => void\n}\n\nexport const useTimerLogic = ({\n autoStart,\n onCycleEnd,\n onMeasuringComplete,\n hasError,\n onPauseAnimation,\n onErrorAnimation,\n onClearErrorAnimation,\n onStartPulsating,\n}: UseTimerLogicProps) => {\n const [timerState, setTimerState] = useState<TimerState>({\n currentState: \"idle\",\n remainingTime: 0,\n maxTime: null,\n isRunning: false,\n isPausedState: false,\n currentProgress: 0,\n wasRunningBeforeError: false,\n })\n\n // Timer-related refs\n const animationRef = useRef<number | null>(null)\n const startTimeRef = useRef<number | null>(null)\n const pausedTimeRef = useRef<number>(0)\n\n // Spring-based interpolator for smooth gauge progress animations\n const [progressInterpolator] = useInterpolation([0], {\n tension: 80,\n friction: 18,\n onChange: ([progress]) => {\n setTimerState((prev) => ({ ...prev, currentProgress: progress }))\n },\n })\n\n const setIdle = useCallback(() => {\n setTimerState((prev) => ({\n ...prev,\n currentState: \"idle\",\n maxTime: null,\n // Don't reset remainingTime - keep the last value\n isRunning: false,\n isPausedState: false,\n currentProgress: 0, // Reset progress to 0 for gauge\n }))\n pausedTimeRef.current = 0\n startTimeRef.current = null\n progressInterpolator.setImmediate([0]) // Use setImmediate for instant reset\n }, [progressInterpolator])\n\n const startMeasuring = useCallback(\n (elapsedSeconds: number = 0) => {\n const initialProgress = ((elapsedSeconds / 60) % 1) * 100\n setTimerState((prev) => ({\n ...prev,\n currentState: \"measuring\",\n maxTime: null,\n remainingTime: elapsedSeconds,\n isPausedState: false,\n currentProgress: initialProgress, // Immediately set progress\n }))\n pausedTimeRef.current = 0\n\n progressInterpolator.setImmediate([initialProgress]) // Use setImmediate for instant reset\n\n if (autoStart) {\n startTimeRef.current = Date.now() - elapsedSeconds * 1000\n setTimerState((prev) => ({ ...prev, isRunning: true }))\n } else {\n startTimeRef.current = null\n }\n },\n [autoStart, progressInterpolator],\n )\n\n const startNewCycle = useCallback(\n (maxTimeSeconds: number, elapsedSeconds: number = 0) => {\n // Stop any running timer first to prevent conflicts\n setTimerState((prev) => ({ ...prev, isRunning: false }))\n startTimeRef.current = null\n\n setTimerState((prev) => ({\n ...prev,\n currentState: \"countdown\",\n maxTime: maxTimeSeconds,\n isPausedState: false,\n }))\n pausedTimeRef.current = 0\n\n // Count-down mode\n const remainingSeconds = Math.max(0, maxTimeSeconds - elapsedSeconds)\n const initialProgress =\n elapsedSeconds > 0 ? (elapsedSeconds / maxTimeSeconds) * 100 : 0\n\n setTimerState((prev) => ({\n ...prev,\n remainingTime: remainingSeconds,\n currentProgress: initialProgress, // Immediately set progress\n }))\n\n progressInterpolator.setImmediate([initialProgress]) // Use setImmediate for instant reset\n\n if (remainingSeconds === 0) {\n setTimerState((prev) => ({ ...prev, isRunning: false }))\n startTimeRef.current = null\n if (onCycleEnd) {\n queueMicrotask(() => onCycleEnd())\n }\n } else if (autoStart) {\n setTimeout(() => {\n startTimeRef.current = Date.now() - elapsedSeconds * 1000\n setTimerState((prev) => ({ ...prev, isRunning: true }))\n }, 0)\n } else {\n startTimeRef.current = null\n }\n },\n [autoStart, onCycleEnd, progressInterpolator],\n )\n\n const completeMeasuring = useCallback(() => {\n // Always trigger completion regardless of current state\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n currentState: \"measured\",\n }))\n startTimeRef.current = null\n\n onStartPulsating(() => {\n if (onMeasuringComplete) {\n onMeasuringComplete()\n }\n })\n }, [onStartPulsating, onMeasuringComplete])\n\n const pause = useCallback(() => {\n if (startTimeRef.current && timerState.isRunning) {\n const now = Date.now()\n const additionalElapsed = now - startTimeRef.current\n pausedTimeRef.current += additionalElapsed\n\n const totalElapsed = pausedTimeRef.current / 1000\n const exactProgress = calculateExactProgress(\n timerState.currentState,\n totalElapsed,\n timerState.maxTime,\n )\n progressInterpolator.setTarget([exactProgress])\n }\n\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n isPausedState: true,\n }))\n onPauseAnimation()\n }, [\n timerState.isRunning,\n timerState.currentState,\n timerState.maxTime,\n progressInterpolator,\n onPauseAnimation,\n ])\n\n const resume = useCallback(() => {\n if (\n timerState.isPausedState &&\n (timerState.remainingTime > 0 || timerState.currentState !== \"countdown\")\n ) {\n startTimeRef.current = Date.now()\n setTimerState((prev) => ({\n ...prev,\n isRunning: true,\n isPausedState: false,\n }))\n }\n }, [\n timerState.isPausedState,\n timerState.remainingTime,\n timerState.currentState,\n ])\n\n const isPaused = useCallback(() => {\n return timerState.isPausedState\n }, [timerState.isPausedState])\n\n // Handle error state changes\n useEffect(() => {\n if (hasError) {\n if (timerState.isRunning && !timerState.isPausedState) {\n setTimerState((prev) => ({ ...prev, wasRunningBeforeError: true }))\n pause()\n }\n onErrorAnimation()\n } else {\n if (timerState.wasRunningBeforeError && timerState.isPausedState) {\n setTimerState((prev) => ({ ...prev, wasRunningBeforeError: false }))\n resume()\n }\n onClearErrorAnimation()\n }\n }, [\n hasError,\n timerState.isRunning,\n timerState.isPausedState,\n timerState.wasRunningBeforeError,\n pause,\n resume,\n onErrorAnimation,\n onClearErrorAnimation,\n ])\n\n // Main timer loop\n useEffect(() => {\n if (timerState.isRunning) {\n const updateTimer = () => {\n if (startTimeRef.current) {\n const now = Date.now()\n const elapsed =\n (now - startTimeRef.current + pausedTimeRef.current) / 1000\n\n if (\n timerState.currentState === \"countdown\" &&\n timerState.maxTime !== null\n ) {\n const remaining = Math.max(0, timerState.maxTime - elapsed)\n setTimerState((prev) => ({\n ...prev,\n remainingTime: Math.ceil(remaining),\n }))\n\n const progress = Math.min(100, (elapsed / timerState.maxTime) * 100)\n progressInterpolator.setTarget([progress])\n\n if (remaining <= 0) {\n setTimerState((prev) => ({\n ...prev,\n isRunning: false,\n remainingTime: 0,\n }))\n startTimeRef.current = null\n progressInterpolator.setTarget([100])\n if (onCycleEnd) {\n queueMicrotask(() => onCycleEnd())\n }\n return\n }\n } else if (timerState.currentState === \"measuring\") {\n setTimerState((prev) => ({\n ...prev,\n remainingTime: Math.floor(elapsed),\n }))\n const progress = ((elapsed / 60) % 1) * 100\n progressInterpolator.setTarget([progress])\n }\n\n if (timerState.isRunning) {\n animationRef.current = requestAnimationFrame(updateTimer)\n }\n }\n }\n\n animationRef.current = requestAnimationFrame(updateTimer)\n } else {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = null\n }\n }\n\n return () => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n }\n }\n }, [\n timerState.isRunning,\n onCycleEnd,\n timerState.currentState,\n timerState.maxTime,\n progressInterpolator,\n ])\n\n // Interpolation animation loop\n useEffect(() => {\n let interpolationAnimationId: number | null = null\n\n const animateInterpolation = () => {\n progressInterpolator.update(1 / 60)\n interpolationAnimationId = requestAnimationFrame(animateInterpolation)\n }\n\n interpolationAnimationId = requestAnimationFrame(animateInterpolation)\n\n return () => {\n if (interpolationAnimationId) {\n cancelAnimationFrame(interpolationAnimationId)\n }\n }\n }, [progressInterpolator])\n\n return {\n timerState,\n controls: {\n startNewCycle,\n startMeasuring,\n setIdle,\n completeMeasuring,\n pause,\n resume,\n isPaused,\n },\n }\n}\n"],"names":["useTimerLogic","autoStart","onCycleEnd","onMeasuringComplete","hasError","onPauseAnimation","onErrorAnimation","onClearErrorAnimation","onStartPulsating","timerState","setTimerState","useState","animationRef","useRef","startTimeRef","pausedTimeRef","progressInterpolator","useInterpolation","progress","prev","setIdle","useCallback","startMeasuring","elapsedSeconds","initialProgress","startNewCycle","maxTimeSeconds","remainingSeconds","completeMeasuring","pause","additionalElapsed","totalElapsed","exactProgress","calculateExactProgress","resume","isPaused","useEffect","updateTimer","elapsed","remaining","interpolationAnimationId","animateInterpolation"],"mappings":";;;AAgBO,MAAMA,IAAgB,CAAC;AAAA,EAC5B,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,kBAAAC;AACF,MAA0B;AACxB,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAqB;AAAA,IACvD,cAAc;AAAA,IACd,eAAe;AAAA,IACf,SAAS;AAAA,IACT,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,uBAAuB;AAAA,EAAA,CACxB,GAGKC,IAAeC,EAAsB,IAAI,GACzCC,IAAeD,EAAsB,IAAI,GACzCE,IAAgBF,EAAe,CAAC,GAGhC,CAACG,CAAoB,IAAIC,EAAiB,CAAC,CAAC,GAAG;AAAA,IACnD,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU,CAAC,C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,CAAoB;AAAA,IACvE;AAEA,WAAAD,IAA2B,sBAAsBC,CAAoB,GAE9D,MAAM;AACX,MAAID,KACF,qBAAqBA,CAAwB;AAAA,IAEjD;AAAA,EACF,GAAG,CAACxB,CAAoB,CAAC,GAElB;AAAA,IACL,YAAAP;AAAA,IACA,UAAU;AAAA,MACR,eAAAgB;AAAA,MACA,gBAAAH;AAAA,MACA,SAAAF;AAAA,MACA,mBAAAQ;AAAA,MACA,OAAAC;AAAA,MACA,QAAAK;AAAA,MACA,UAAAC;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=r=>{const i=Math.floor(r/86400),o=Math.floor(r%86400/3600),n=Math.floor(r%3600/60),a=r%60,t=[];return i>0?(t.push(i.toString()),t.push(o.toString().padStart(2,"0")),t.push(n.toString().padStart(2,"0")),t.push(a.toString().padStart(2,"0"))):o>0?(t.push(o.toString()),t.push(n.toString().padStart(2,"0")),t.push(a.toString().padStart(2,"0"))):(t.push(n.toString()),t.push(a.toString().padStart(2,"0"))),t.join(":")},f=(r,i)=>{const o=Math.floor(r/86400),n=Math.floor(r%86400/3600),a=Math.floor(r%3600/60),t=r%60;if(typeof Intl<"u"&&"DurationFormat"in Intl)try{const e={};return o>0&&(e.days=o),n>0&&(e.hours=n),a>0&&(e.minutes=a),(t>0||Object.keys(e).length===0)&&(e.seconds=t),new Intl.DurationFormat(i,{style:"narrow"}).format(e)}catch{}const s=[];return o>0&&s.push(`${o}d`),n>0&&s.push(`${n}h`),a>0&&s.push(`${a}m`),(t>0||s.length===0)&&s.push(`${t}s`),s.join(" ")},h=(r,i,o)=>r==="countdown"&&o!==null?Math.min(100,i/o*100):r==="measuring"?i/60%1*100:0;exports.calculateExactProgress=h;exports.formatTime=u;exports.formatTimeLocalized=f;
2
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","sources":["../../../src/components/CycleTimer/utils.ts"],"sourcesContent":["/**\n * Formats time in seconds to D:HH:MM:SS, H:MM:SS or MM:SS format\n * Used for the default (large) timer variant\n * Automatically includes days and hours as needed for clarity\n */\nexport const formatTime = (seconds: number): string => {\n const days = Math.floor(seconds / 86400)\n const hours = Math.floor((seconds % 86400) / 3600)\n const minutes = Math.floor((seconds % 3600) / 60)\n const remainingSeconds = seconds % 60\n\n // Build time parts array\n const parts: string[] = []\n\n if (days > 0) {\n parts.push(days.toString())\n parts.push(hours.toString().padStart(2, \"0\"))\n parts.push(minutes.toString().padStart(2, \"0\"))\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n } else if (hours > 0) {\n parts.push(hours.toString())\n parts.push(minutes.toString().padStart(2, \"0\"))\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n } else {\n parts.push(minutes.toString())\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n }\n\n return parts.join(\":\")\n}\n\n/**\n * Formats time in seconds to a localized human-readable format\n * Used for the small timer variant\n * Examples: \"2h 30m 15s\", \"45m 30s\", \"30s\"\n * Falls back to English units if Intl.DurationFormat is not available\n */\nexport const formatTimeLocalized = (\n seconds: number,\n locale?: string,\n): string => {\n const days = Math.floor(seconds / 86400)\n const hours = Math.floor((seconds % 86400) / 3600)\n const minutes = Math.floor((seconds % 3600) / 60)\n const remainingSeconds = seconds % 60\n\n // Try using Intl.DurationFormat if available (newer browsers)\n if (typeof Intl !== \"undefined\" && \"DurationFormat\" in Intl) {\n try {\n const duration: Record<string, number> = {}\n if (days > 0) duration.days = days\n if (hours > 0) duration.hours = hours\n if (minutes > 0) duration.minutes = minutes\n if (remainingSeconds > 0 || Object.keys(duration).length === 0) {\n duration.seconds = remainingSeconds\n }\n\n // @ts-expect-error - DurationFormat is not yet in TypeScript types\n const formatter = new Intl.DurationFormat(locale, { style: \"narrow\" })\n return formatter.format(duration)\n } catch {\n // Fall through to manual formatting\n }\n }\n\n // Manual formatting with compact units\n const parts: string[] = []\n\n if (days > 0) parts.push(`${days}d`)\n if (hours > 0) parts.push(`${hours}h`)\n if (minutes > 0) parts.push(`${minutes}m`)\n if (remainingSeconds > 0 || parts.length === 0) {\n parts.push(`${remainingSeconds}s`)\n }\n\n return parts.join(\" \")\n}\n\n/**\n * Calculates progress percentage for different timer states\n */\nexport const calculateProgress = (\n currentState: string,\n remainingTime: number,\n maxTime: number | null,\n): number => {\n if (currentState === \"idle\") {\n return 0\n }\n\n if (currentState === \"countdown\" && maxTime !== null) {\n // Count-down mode: progress based on elapsed time\n const elapsed = maxTime - remainingTime\n return Math.min(100, (elapsed / maxTime) * 100)\n }\n\n if (currentState === \"measuring\") {\n // Measuring mode: progress based on minute steps (0-100% per minute)\n return ((remainingTime / 60) % 1) * 100\n }\n\n return 0\n}\n\n/**\n * Calculates exact progress position based on elapsed time\n */\nexport const calculateExactProgress = (\n currentState: string,\n totalElapsed: number,\n maxTime: number | null,\n): number => {\n if (currentState === \"countdown\" && maxTime !== null) {\n return Math.min(100, (totalElapsed / maxTime) * 100)\n }\n\n if (currentState === \"measuring\") {\n return ((totalElapsed / 60) % 1) * 100\n }\n\n return 0\n}\n"],"names":["formatTime","seconds","days","hours","minutes","remainingSeconds","parts","formatTimeLocalized","locale","duration","calculateExactProgress","currentState","totalElapsed","maxTime"],"mappings":"gFAKO,MAAMA,EAAcC,GAA4B,CACrD,MAAMC,EAAO,KAAK,MAAMD,EAAU,KAAK,EACjCE,EAAQ,KAAK,MAAOF,EAAU,MAAS,IAAI,EAC3CG,EAAU,KAAK,MAAOH,EAAU,KAAQ,EAAE,EAC1CI,EAAmBJ,EAAU,GAG7BK,EAAkB,CAAA,EAExB,OAAIJ,EAAO,GACTI,EAAM,KAAKJ,EAAK,UAAU,EAC1BI,EAAM,KAAKH,EAAM,SAAA,EAAW,SAAS,EAAG,GAAG,CAAC,EAC5CG,EAAM,KAAKF,EAAQ,SAAA,EAAW,SAAS,EAAG,GAAG,CAAC,EAC9CE,EAAM,KAAKD,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C,IAEIF,IAAiB,aAAeE,IAAY,KACvC,KAAK,IAAI,IAAMD,EAAeC,EAAW,GAAG,EAGjDF,IAAiB,YACVC,EAAe,GAAM,EAAK,IAG9B"}
@@ -0,0 +1,20 @@
1
+ const e = (r) => {
2
+ const a = Math.floor(r / 86400), o = Math.floor(r % 86400 / 3600), n = Math.floor(r % 3600 / 60), i = r % 60, t = [];
3
+ return a > 0 ? (t.push(a.toString()), t.push(o.toString().padStart(2, "0")), t.push(n.toString().padStart(2, "0")), t.push(i.toString().padStart(2, "0"))) : o > 0 ? (t.push(o.toString()), t.push(n.toString().padStart(2, "0")), t.push(i.toString().padStart(2, "0"))) : (t.push(n.toString()), t.push(i.toString().padStart(2, "0"))), t.join(":");
4
+ }, f = (r, a) => {
5
+ const o = Math.floor(r / 86400), n = Math.floor(r % 86400 / 3600), i = Math.floor(r % 3600 / 60), t = r % 60;
6
+ if (typeof Intl < "u" && "DurationFormat" in Intl)
7
+ try {
8
+ const u = {};
9
+ return o > 0 && (u.days = o), n > 0 && (u.hours = n), i > 0 && (u.minutes = i), (t > 0 || Object.keys(u).length === 0) && (u.seconds = t), new Intl.DurationFormat(a, { style: "narrow" }).format(u);
10
+ } catch {
11
+ }
12
+ const s = [];
13
+ return o > 0 && s.push(`${o}d`), n > 0 && s.push(`${n}h`), i > 0 && s.push(`${i}m`), (t > 0 || s.length === 0) && s.push(`${t}s`), s.join(" ");
14
+ }, p = (r, a, o) => r === "countdown" && o !== null ? Math.min(100, a / o * 100) : r === "measuring" ? a / 60 % 1 * 100 : 0;
15
+ export {
16
+ p as calculateExactProgress,
17
+ e as formatTime,
18
+ f as formatTimeLocalized
19
+ };
20
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/components/CycleTimer/utils.ts"],"sourcesContent":["/**\n * Formats time in seconds to D:HH:MM:SS, H:MM:SS or MM:SS format\n * Used for the default (large) timer variant\n * Automatically includes days and hours as needed for clarity\n */\nexport const formatTime = (seconds: number): string => {\n const days = Math.floor(seconds / 86400)\n const hours = Math.floor((seconds % 86400) / 3600)\n const minutes = Math.floor((seconds % 3600) / 60)\n const remainingSeconds = seconds % 60\n\n // Build time parts array\n const parts: string[] = []\n\n if (days > 0) {\n parts.push(days.toString())\n parts.push(hours.toString().padStart(2, \"0\"))\n parts.push(minutes.toString().padStart(2, \"0\"))\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n } else if (hours > 0) {\n parts.push(hours.toString())\n parts.push(minutes.toString().padStart(2, \"0\"))\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n } else {\n parts.push(minutes.toString())\n parts.push(remainingSeconds.toString().padStart(2, \"0\"))\n }\n\n return parts.join(\":\")\n}\n\n/**\n * Formats time in seconds to a localized human-readable format\n * Used for the small timer variant\n * Examples: \"2h 30m 15s\", \"45m 30s\", \"30s\"\n * Falls back to English units if Intl.DurationFormat is not available\n */\nexport const formatTimeLocalized = (\n seconds: number,\n locale?: string,\n): string => {\n const days = Math.floor(seconds / 86400)\n const hours = Math.floor((seconds % 86400) / 3600)\n const minutes = Math.floor((seconds % 3600) / 60)\n const remainingSeconds = seconds % 60\n\n // Try using Intl.DurationFormat if available (newer browsers)\n if (typeof Intl !== \"undefined\" && \"DurationFormat\" in Intl) {\n try {\n const duration: Record<string, number> = {}\n if (days > 0) duration.days = days\n if (hours > 0) duration.hours = hours\n if (minutes > 0) duration.minutes = minutes\n if (remainingSeconds > 0 || Object.keys(duration).length === 0) {\n duration.seconds = remainingSeconds\n }\n\n // @ts-expect-error - DurationFormat is not yet in TypeScript types\n const formatter = new Intl.DurationFormat(locale, { style: \"narrow\" })\n return formatter.format(duration)\n } catch {\n // Fall through to manual formatting\n }\n }\n\n // Manual formatting with compact units\n const parts: string[] = []\n\n if (days > 0) parts.push(`${days}d`)\n if (hours > 0) parts.push(`${hours}h`)\n if (minutes > 0) parts.push(`${minutes}m`)\n if (remainingSeconds > 0 || parts.length === 0) {\n parts.push(`${remainingSeconds}s`)\n }\n\n return parts.join(\" \")\n}\n\n/**\n * Calculates progress percentage for different timer states\n */\nexport const calculateProgress = (\n currentState: string,\n remainingTime: number,\n maxTime: number | null,\n): number => {\n if (currentState === \"idle\") {\n return 0\n }\n\n if (currentState === \"countdown\" && maxTime !== null) {\n // Count-down mode: progress based on elapsed time\n const elapsed = maxTime - remainingTime\n return Math.min(100, (elapsed / maxTime) * 100)\n }\n\n if (currentState === \"measuring\") {\n // Measuring mode: progress based on minute steps (0-100% per minute)\n return ((remainingTime / 60) % 1) * 100\n }\n\n return 0\n}\n\n/**\n * Calculates exact progress position based on elapsed time\n */\nexport const calculateExactProgress = (\n currentState: string,\n totalElapsed: number,\n maxTime: number | null,\n): number => {\n if (currentState === \"countdown\" && maxTime !== null) {\n return Math.min(100, (totalElapsed / maxTime) * 100)\n }\n\n if (currentState === \"measuring\") {\n return ((totalElapsed / 60) % 1) * 100\n }\n\n return 0\n}\n"],"names":["formatTime","seconds","days","hours","minutes","remainingSeconds","parts","formatTimeLocalized","locale","duration","calculateExactProgress","currentState","totalElapsed","maxTime"],"mappings":"AAKO,MAAMA,IAAa,CAACC,MAA4B;AACrD,QAAMC,IAAO,KAAK,MAAMD,IAAU,KAAK,GACjCE,IAAQ,KAAK,MAAOF,IAAU,QAAS,IAAI,GAC3CG,IAAU,KAAK,MAAOH,IAAU,OAAQ,EAAE,GAC1CI,IAAmBJ,IAAU,IAG7BK,IAAkB,CAAA;AAExB,SAAIJ,IAAO,KACTI,EAAM,KAAKJ,EAAK,UAAU,GAC1BI,EAAM,KAAKH,EAAM,SAAA,EAAW,SAAS,GAAG,GAAG,CAAC,GAC5CG,EAAM,KAAKF,EAAQ,SAAA,EAAW,SAAS,GAAG,GAAG,CAAC,GAC9CE,EAAM,KAAKD,EAAiB,SAAA,EAAW,SAAS,GAAG,GAAG,CAAC,KAC9CF,IAAQ,KACjBG,EAAM,KAAKH,EAAM,UAAU,GAC3BG,EAAM,KAAKF,EAAQ,SAAA,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MAG9B;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./CycleTimer/index.cjs");exports.CycleTimer=e.CycleTimer;exports.default=e.CycleTimer;
2
+ //# sourceMappingURL=CycleTimer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CycleTimer.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  export { CycleTimer } from "./CycleTimer/index";
2
2
  export type { CycleTimerControls, CycleTimerProps, CycleTimerState, } from "./CycleTimer/types";
3
+ export { CycleTimer as default } from "./CycleTimer/index";
3
4
  //# sourceMappingURL=CycleTimer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CycleTimer.d.ts","sourceRoot":"","sources":["../../src/components/CycleTimer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"CycleTimer.d.ts","sourceRoot":"","sources":["../../src/components/CycleTimer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { CycleTimer as l, CycleTimer as m } from "./CycleTimer/index.js";
2
+ export {
3
+ l as CycleTimer,
4
+ m as default
5
+ };
6
+ //# sourceMappingURL=CycleTimer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CycleTimer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}