@adcops/autocore-react 3.0.40 → 3.1.1

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 (393) hide show
  1. package/additional-docs/AutoCoreTagContext.md +441 -0
  2. package/dist/assets/BlocklyLogo.d.ts +1 -0
  3. package/dist/assets/BlocklyLogo.d.ts.map +1 -0
  4. package/dist/assets/Distance.d.ts +1 -0
  5. package/dist/assets/Distance.d.ts.map +1 -0
  6. package/dist/assets/JogLong.d.ts +1 -0
  7. package/dist/assets/JogLong.d.ts.map +1 -0
  8. package/dist/assets/JogMedium.d.ts +1 -0
  9. package/dist/assets/JogMedium.d.ts.map +1 -0
  10. package/dist/assets/JogShort.d.ts +1 -0
  11. package/dist/assets/JogShort.d.ts.map +1 -0
  12. package/dist/assets/PythonLogo.d.ts +1 -0
  13. package/dist/assets/PythonLogo.d.ts.map +1 -0
  14. package/dist/assets/Rotation3D.d.ts +1 -0
  15. package/dist/assets/Rotation3D.d.ts.map +1 -0
  16. package/dist/assets/RotationCcw.d.ts +1 -0
  17. package/dist/assets/RotationCcw.d.ts.map +1 -0
  18. package/dist/assets/RotationCcwA.d.ts +1 -0
  19. package/dist/assets/RotationCcwA.d.ts.map +1 -0
  20. package/dist/assets/RotationCcwB.d.ts +1 -0
  21. package/dist/assets/RotationCcwB.d.ts.map +1 -0
  22. package/dist/assets/RotationCcwC.d.ts +1 -0
  23. package/dist/assets/RotationCcwC.d.ts.map +1 -0
  24. package/dist/assets/RotationCw.d.ts +1 -0
  25. package/dist/assets/RotationCw.d.ts.map +1 -0
  26. package/dist/assets/RotationCwA.d.ts +1 -0
  27. package/dist/assets/RotationCwA.d.ts.map +1 -0
  28. package/dist/assets/RotationCwB.d.ts +1 -0
  29. package/dist/assets/RotationCwB.d.ts.map +1 -0
  30. package/dist/assets/RotationCwC.d.ts +1 -0
  31. package/dist/assets/RotationCwC.d.ts.map +1 -0
  32. package/dist/assets/Run.d.ts +1 -0
  33. package/dist/assets/Run.d.ts.map +1 -0
  34. package/dist/assets/Speed.d.ts +1 -0
  35. package/dist/assets/Speed.d.ts.map +1 -0
  36. package/dist/assets/SpeedFast.d.ts +1 -0
  37. package/dist/assets/SpeedFast.d.ts.map +1 -0
  38. package/dist/assets/SpeedMedium.d.ts +1 -0
  39. package/dist/assets/SpeedMedium.d.ts.map +1 -0
  40. package/dist/assets/SpeedNone.d.ts +1 -0
  41. package/dist/assets/SpeedNone.d.ts.map +1 -0
  42. package/dist/assets/SpeedSlow.d.ts +1 -0
  43. package/dist/assets/SpeedSlow.d.ts.map +1 -0
  44. package/dist/assets/Walk.d.ts +1 -0
  45. package/dist/assets/Walk.d.ts.map +1 -0
  46. package/dist/assets/index.d.ts +1 -0
  47. package/dist/assets/index.d.ts.map +1 -0
  48. package/dist/components/AutoCoreDevPanel.d.ts +144 -0
  49. package/dist/components/AutoCoreDevPanel.d.ts.map +1 -0
  50. package/dist/components/AutoCoreDevPanel.js +1 -0
  51. package/dist/components/BlocklyEditor.d.ts +1 -0
  52. package/dist/components/BlocklyEditor.d.ts.map +1 -0
  53. package/dist/components/BlocklyEditor.js +1 -1
  54. package/dist/components/CodeEditor.d.ts +2 -1
  55. package/dist/components/CodeEditor.d.ts.map +1 -0
  56. package/dist/components/CodeEditor.js +1 -1
  57. package/dist/components/FileList.d.ts +1 -0
  58. package/dist/components/FileList.d.ts.map +1 -0
  59. package/dist/components/FileList.js +1 -1
  60. package/dist/components/FileSelect.d.ts +1 -0
  61. package/dist/components/FileSelect.d.ts.map +1 -0
  62. package/dist/components/FileSelect.js +1 -1
  63. package/dist/components/FitText.d.ts +1 -0
  64. package/dist/components/FitText.d.ts.map +1 -0
  65. package/dist/components/FitText.js +1 -1
  66. package/dist/components/Indicator.d.ts +2 -1
  67. package/dist/components/Indicator.d.ts.map +1 -0
  68. package/dist/components/Indicator.js +1 -1
  69. package/dist/components/IndicatorButton.d.ts +2 -1
  70. package/dist/components/IndicatorButton.d.ts.map +1 -0
  71. package/dist/components/IndicatorButton.js +1 -1
  72. package/dist/components/IndicatorRect.d.ts +2 -1
  73. package/dist/components/IndicatorRect.d.ts.map +1 -0
  74. package/dist/components/JogPanel.d.ts +1 -0
  75. package/dist/components/JogPanel.d.ts.map +1 -0
  76. package/dist/components/Lamp.d.ts +2 -1
  77. package/dist/components/Lamp.d.ts.map +1 -0
  78. package/dist/components/Lamp.js +1 -1
  79. package/dist/components/Osk.d.ts +1 -0
  80. package/dist/components/Osk.d.ts.map +1 -0
  81. package/dist/components/Osk.js +1 -1
  82. package/dist/components/OskDialog.d.ts +1 -0
  83. package/dist/components/OskDialog.d.ts.map +1 -0
  84. package/dist/components/ProgressBarWithValue.d.ts +1 -0
  85. package/dist/components/ProgressBarWithValue.d.ts.map +1 -0
  86. package/dist/components/ProgressBarWithValue.js +1 -1
  87. package/dist/components/TextInput.d.ts +62 -103
  88. package/dist/components/TextInput.d.ts.map +1 -0
  89. package/dist/components/TextInput.js +1 -1
  90. package/dist/components/ToggleGroup.d.ts +2 -1
  91. package/dist/components/ToggleGroup.d.ts.map +1 -0
  92. package/dist/components/ToggleGroup.js +1 -1
  93. package/dist/components/ValueDisplay.d.ts +3 -2
  94. package/dist/components/ValueDisplay.d.ts.map +1 -0
  95. package/dist/components/ValueDisplay.js +1 -1
  96. package/dist/components/ValueIndicator.d.ts +2 -1
  97. package/dist/components/ValueIndicator.d.ts.map +1 -0
  98. package/dist/components/ValueIndicator.js +1 -1
  99. package/dist/components/ValueInput.d.ts +2 -1
  100. package/dist/components/ValueInput.d.ts.map +1 -0
  101. package/dist/components/ValueInput.js +1 -1
  102. package/dist/core/ActionMode.d.ts +1 -0
  103. package/dist/core/ActionMode.d.ts.map +1 -0
  104. package/dist/core/AutoCoreTagContext.d.ts +224 -0
  105. package/dist/core/AutoCoreTagContext.d.ts.map +1 -0
  106. package/dist/core/AutoCoreTagContext.js +1 -0
  107. package/dist/core/AutoCoreTagTypes.d.ts +162 -0
  108. package/dist/core/AutoCoreTagTypes.d.ts.map +1 -0
  109. package/dist/core/AutoCoreTagTypes.js +1 -0
  110. package/dist/core/EventEmitterContext.d.ts +295 -2
  111. package/dist/core/EventEmitterContext.d.ts.map +1 -0
  112. package/dist/core/EventEmitterContext.js +1 -1
  113. package/dist/core/IndicatorButtonState.d.ts +1 -0
  114. package/dist/core/IndicatorButtonState.d.ts.map +1 -0
  115. package/dist/core/IndicatorColor.d.ts +1 -0
  116. package/dist/core/IndicatorColor.d.ts.map +1 -0
  117. package/dist/core/MaskPatterns.d.ts +1 -0
  118. package/dist/core/MaskPatterns.d.ts.map +1 -0
  119. package/dist/core/NumerableTypes.d.ts +1 -0
  120. package/dist/core/NumerableTypes.d.ts.map +1 -0
  121. package/dist/core/NumerableTypes.js +1 -1
  122. package/dist/core/PositionContext.d.ts +1 -1
  123. package/dist/core/PositionContext.d.ts.map +1 -0
  124. package/dist/core/UniqueId.d.ts +1 -0
  125. package/dist/core/UniqueId.d.ts.map +1 -0
  126. package/dist/core/ValueSimulator.d.ts +2 -1
  127. package/dist/core/ValueSimulator.d.ts.map +1 -0
  128. package/dist/core/ValueSimulator.js +1 -1
  129. package/dist/core/hoc.d.ts +1 -0
  130. package/dist/core/hoc.d.ts.map +1 -0
  131. package/dist/core/hoc.js +1 -1
  132. package/dist/hooks/adsHooks.d.ts +1 -0
  133. package/dist/hooks/adsHooks.d.ts.map +1 -0
  134. package/dist/hooks/adsHooks.js +1 -1
  135. package/dist/hooks/commandHooks.d.ts +1 -0
  136. package/dist/hooks/commandHooks.d.ts.map +1 -0
  137. package/dist/hooks/commandHooks.js +1 -1
  138. package/dist/hooks/index.d.ts +1 -0
  139. package/dist/hooks/index.d.ts.map +1 -0
  140. package/dist/hooks/useAutoCoreTag.d.ts +26 -0
  141. package/dist/hooks/useAutoCoreTag.d.ts.map +1 -0
  142. package/dist/hooks/useAutoCoreTag.js +1 -0
  143. package/dist/hooks/useScaledValue.d.ts +1 -0
  144. package/dist/hooks/useScaledValue.d.ts.map +1 -0
  145. package/dist/hooks/useScaledValue.js +1 -1
  146. package/dist/hub/CommandMessage.d.ts +1 -0
  147. package/dist/hub/CommandMessage.d.ts.map +1 -0
  148. package/dist/hub/HubBase.d.ts +3 -2
  149. package/dist/hub/HubBase.d.ts.map +1 -0
  150. package/dist/hub/HubSimulate.d.ts +2 -1
  151. package/dist/hub/HubSimulate.d.ts.map +1 -0
  152. package/dist/hub/HubSimulate.js +1 -1
  153. package/dist/hub/HubTauri.d.ts +2 -1
  154. package/dist/hub/HubTauri.d.ts.map +1 -0
  155. package/dist/hub/HubTauri.js +1 -1
  156. package/dist/hub/HubWebSocket.d.ts +2 -1
  157. package/dist/hub/HubWebSocket.d.ts.map +1 -0
  158. package/dist/hub/HubWebSocket.js +1 -1
  159. package/dist/hub/index.d.ts +2 -1
  160. package/dist/hub/index.d.ts.map +1 -0
  161. package/dist/hub/index.js +1 -1
  162. package/docs/.nojekyll +1 -0
  163. package/docs/assets/hierarchy.js +1 -0
  164. package/docs/assets/highlight.css +134 -0
  165. package/docs/assets/icons.js +18 -0
  166. package/docs/assets/icons.svg +1 -0
  167. package/docs/assets/main.js +60 -0
  168. package/docs/assets/navigation.js +1 -0
  169. package/docs/assets/search.js +1 -0
  170. package/docs/assets/style.css +1633 -0
  171. package/docs/classes/components_CodeEditor.CodeEditor.html +108 -101
  172. package/docs/classes/components_Indicator.Indicator.html +122 -0
  173. package/docs/classes/components_IndicatorRect.IndicatorRect.html +121 -0
  174. package/docs/classes/components_JogPanel.JogPanel.html +104 -106
  175. package/docs/classes/components_Lamp.Lamp.html +96 -79
  176. package/docs/classes/components_OskDialog.OskDialog.html +125 -0
  177. package/docs/classes/components_TextInput.TextInput.html +99 -89
  178. package/docs/classes/components_ValueDisplay.ValueDisplay.html +148 -0
  179. package/docs/classes/components_ValueIndicator.ValueIndicator.html +98 -91
  180. package/docs/classes/core_ValueSimulator.ValueSimulator.html +51 -0
  181. package/docs/classes/hub_HubBase.HubBase.html +106 -0
  182. package/docs/classes/hub_HubSimulate.HubSimulate.html +75 -0
  183. package/docs/classes/hub_HubTauri.HubTauri.html +93 -0
  184. package/docs/classes/hub_HubWebSocket.HubWebSocket.html +75 -69
  185. package/docs/documents/core_AutoCoreTagContext.AutoCoreTagContext.html +148 -0
  186. package/docs/enums/components_JogPanel.JogDistanceAction.html +5 -5
  187. package/docs/enums/components_JogPanel.JogPanelAction.html +18 -18
  188. package/docs/enums/components_JogPanel.JogSpeedAction.html +5 -5
  189. package/docs/enums/core_ActionMode.ActionMode.html +6 -6
  190. package/docs/enums/core_IndicatorColor.IndicatorColor.html +22 -22
  191. package/docs/functions/assets.BlocklyLogo.html +1 -0
  192. package/docs/functions/assets.Distance.html +1 -0
  193. package/docs/functions/assets.JogLong.html +1 -0
  194. package/docs/functions/assets.JogMedium.html +1 -0
  195. package/docs/functions/assets.JogShort.html +1 -0
  196. package/docs/functions/assets.PythonLogo.html +1 -0
  197. package/docs/functions/assets.Rotation3D.html +1 -0
  198. package/docs/functions/assets.RotationCcw.html +1 -0
  199. package/docs/functions/assets.RotationCcwA.html +1 -0
  200. package/docs/functions/assets.RotationCcwB.html +1 -0
  201. package/docs/functions/assets.RotationCcwC.html +1 -0
  202. package/docs/functions/assets.RotationCw.html +1 -0
  203. package/docs/functions/assets.RotationCwA.html +1 -0
  204. package/docs/functions/assets.RotationCwB.html +1 -0
  205. package/docs/functions/assets.RotationCwC.html +1 -0
  206. package/docs/functions/assets.Run.html +1 -0
  207. package/docs/functions/assets.Speed.html +1 -0
  208. package/docs/functions/assets.SpeedFast.html +1 -0
  209. package/docs/functions/assets.SpeedMedium.html +1 -0
  210. package/docs/functions/assets.SpeedNone.html +1 -0
  211. package/docs/functions/assets.SpeedSlow.html +1 -0
  212. package/docs/functions/assets.Walk.html +1 -0
  213. package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +5 -5
  214. package/docs/functions/core_UniqueId.UniqueId.html +9 -0
  215. package/docs/functions/core_hoc.hocAddSubscription.html +6 -0
  216. package/docs/functions/hooks_adsHooks.useAdsRegisterSymbols.html +16 -0
  217. package/docs/functions/hooks_adsHooks.useAdsTapValue.html +8 -0
  218. package/docs/functions/hooks_adsHooks.useAdsWriteScaledValue.html +18 -0
  219. package/docs/functions/hooks_adsHooks.useAdsWriteValue.html +9 -0
  220. package/docs/functions/hooks_commandHooks.useRegisterSymbols.html +16 -0
  221. package/docs/functions/hooks_commandHooks.useTapValue.html +10 -0
  222. package/docs/functions/hooks_commandHooks.useWriteScaledValue.html +18 -0
  223. package/docs/functions/hooks_commandHooks.useWriteValue.html +11 -0
  224. package/docs/functions/hooks_useAutoCoreTag.ts.makeAutoCoreTagHooks.html +12 -0
  225. package/docs/functions/hooks_useScaledValue.useScaledValue.html +18 -0
  226. package/docs/functions/hub.createHub.html +3 -0
  227. package/docs/hierarchy.html +1 -0
  228. package/docs/index.html +148 -0
  229. package/docs/interfaces/components_IndicatorButton.IndicatorButtonProps.html +654 -0
  230. package/docs/interfaces/components_IndicatorRect.IndicatorRectProps.html +37 -0
  231. package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +5 -5
  232. package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +545 -519
  233. package/docs/interfaces/core_AutoCoreTagTypes.BaseContextValue.html +12 -0
  234. package/docs/interfaces/core_AutoCoreTagTypes.ScaleConfig.html +13 -0
  235. package/docs/interfaces/core_EventEmitterContext.Action.html +8 -0
  236. package/docs/interfaces/core_EventEmitterContext.EventEmitterContextType.html +33 -0
  237. package/docs/interfaces/core_EventEmitterContext.State.html +8 -0
  238. package/docs/interfaces/core_EventEmitterContext.Subscription.html +6 -0
  239. package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +10 -10
  240. package/docs/interfaces/core_PositionContext.IPositionContext.html +17 -0
  241. package/docs/interfaces/hub_CommandMessage.CommandMessage.html +6 -6
  242. package/docs/interfaces/hub_CommandMessage.CommandMessageResult.html +4 -4
  243. package/docs/modules/assets.html +1 -23
  244. package/docs/modules/assets_BlocklyLogo.html +1 -2
  245. package/docs/modules/assets_Distance.html +1 -2
  246. package/docs/modules/assets_JogLong.html +1 -2
  247. package/docs/modules/assets_JogMedium.html +1 -2
  248. package/docs/modules/assets_JogShort.html +1 -2
  249. package/docs/modules/assets_PythonLogo.html +1 -2
  250. package/docs/modules/assets_Rotation3D.html +1 -2
  251. package/docs/modules/assets_RotationCcw.html +1 -2
  252. package/docs/modules/assets_RotationCcwA.html +1 -2
  253. package/docs/modules/assets_RotationCcwB.html +1 -2
  254. package/docs/modules/assets_RotationCcwC.html +1 -2
  255. package/docs/modules/assets_RotationCw.html +1 -2
  256. package/docs/modules/assets_RotationCwA.html +1 -2
  257. package/docs/modules/assets_RotationCwB.html +1 -2
  258. package/docs/modules/assets_RotationCwC.html +1 -2
  259. package/docs/modules/assets_Run.html +1 -2
  260. package/docs/modules/assets_Speed.html +1 -2
  261. package/docs/modules/assets_SpeedFast.html +1 -2
  262. package/docs/modules/assets_SpeedMedium.html +1 -2
  263. package/docs/modules/assets_SpeedNone.html +1 -2
  264. package/docs/modules/assets_SpeedSlow.html +1 -2
  265. package/docs/modules/assets_Walk.html +1 -2
  266. package/docs/modules/components_AutoCoreDevPanel.html +20 -0
  267. package/docs/modules/components_BlocklyEditor.html +1 -5
  268. package/docs/modules/components_CodeEditor.html +1 -3
  269. package/docs/modules/components_FileList.html +1 -3
  270. package/docs/modules/components_FileSelect.html +1 -0
  271. package/docs/modules/components_FitText.html +1 -3
  272. package/docs/modules/components_Indicator.html +1 -0
  273. package/docs/modules/components_IndicatorButton.html +1 -0
  274. package/docs/modules/components_IndicatorRect.html +1 -0
  275. package/docs/modules/components_JogPanel.html +1 -9
  276. package/docs/modules/components_Lamp.html +1 -4
  277. package/docs/modules/components_Osk.html +1 -0
  278. package/docs/modules/components_OskDialog.html +1 -0
  279. package/docs/modules/components_ProgressBarWithValue.html +1 -0
  280. package/docs/modules/components_TextInput.html +1 -2
  281. package/docs/modules/components_ToggleGroup.html +1 -6
  282. package/docs/modules/components_ValueDisplay.html +1 -0
  283. package/docs/modules/components_ValueIndicator.html +1 -4
  284. package/docs/modules/components_ValueInput.html +1 -2
  285. package/docs/modules/core_ActionMode.html +1 -2
  286. package/docs/modules/core_AutoCoreTagContext.html +11 -0
  287. package/docs/modules/core_AutoCoreTagTypes.html +1 -0
  288. package/docs/modules/core_EventEmitterContext.html +53 -0
  289. package/docs/modules/core_IndicatorButtonState.html +1 -2
  290. package/docs/modules/core_IndicatorColor.html +1 -2
  291. package/docs/modules/core_MaskPatterns.html +1 -0
  292. package/docs/modules/core_NumerableTypes.html +1 -0
  293. package/docs/modules/core_PositionContext.html +1 -0
  294. package/docs/modules/core_UniqueId.html +1 -0
  295. package/docs/modules/core_ValueSimulator.html +1 -0
  296. package/docs/modules/core_hoc.html +1 -0
  297. package/docs/modules/hooks.html +1 -0
  298. package/docs/modules/hooks_adsHooks.html +1 -0
  299. package/docs/modules/hooks_commandHooks.html +1 -0
  300. package/docs/modules/hooks_useAutoCoreTag.ts.html +52 -0
  301. package/docs/modules/hooks_useScaledValue.html +1 -0
  302. package/docs/modules/hub.html +1 -0
  303. package/docs/modules/hub_CommandMessage.html +1 -3
  304. package/docs/modules/hub_HubBase.html +1 -0
  305. package/docs/modules/hub_HubSimulate.html +1 -0
  306. package/docs/modules/hub_HubTauri.html +1 -0
  307. package/docs/modules/hub_HubWebSocket.html +1 -2
  308. package/docs/modules.html +23 -0
  309. package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +1 -1
  310. package/docs/types/core_AutoCoreTagTypes.ExtractByTag.html +2 -0
  311. package/docs/types/core_AutoCoreTagTypes.PrimitiveKind.html +1 -0
  312. package/docs/types/core_AutoCoreTagTypes.TagConfig.html +16 -0
  313. package/docs/types/core_AutoCoreTagTypes.TagValueMap.html +1 -0
  314. package/docs/types/core_AutoCoreTagTypes.TagValueOf.html +1 -0
  315. package/docs/types/core_EventEmitterContext.EmitterDispatchFunction.html +3 -0
  316. package/docs/types/core_EventEmitterContext.EmitterSubscribeFunction.html +3 -0
  317. package/docs/types/core_EventEmitterContext.EmitterUnsubscribeFunction.html +3 -0
  318. package/docs/types/core_NumerableTypes.NumerableFormatOptions.html +4 -0
  319. package/docs/types/core_hoc.HocAddSubscriptionProps.html +6 -0
  320. package/docs/variables/components_AutoCoreDevPanel.AutoCoreDevPanel.html +43 -0
  321. package/docs/variables/components_BlocklyEditor.BlocklyEditor.html +13 -0
  322. package/docs/variables/components_BlocklyEditor.StandardToolbox.html +1 -1
  323. package/docs/variables/components_FileList.FileList.html +23 -0
  324. package/docs/variables/components_FileSelect.FileSelect.html +1 -0
  325. package/docs/variables/components_FitText.FitText.html +4 -0
  326. package/docs/variables/components_IndicatorButton.IndicatorButton.html +1 -0
  327. package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +2 -2
  328. package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +2 -2
  329. package/docs/variables/components_Osk.Osk.html +1 -0
  330. package/docs/variables/components_ProgressBarWithValue.ProgressBarWithValue.html +1 -0
  331. package/docs/variables/components_ToggleGroup.ToggleGroup.html +1 -0
  332. package/docs/variables/components_ValueInput.ValueInput.html +4 -0
  333. package/docs/variables/core_AutoCoreTagContext.AutoCoreTagContext.html +1 -0
  334. package/docs/variables/core_AutoCoreTagContext.AutoCoreTagProvider.html +7 -0
  335. package/docs/variables/core_EventEmitterContext.EventEmitterContext.html +64 -0
  336. package/docs/variables/core_EventEmitterContext.EventEmitterProvider.html +10 -0
  337. package/docs/variables/core_MaskPatterns.PrimeReactMaskPatterns.html +14 -0
  338. package/docs/variables/core_MaskPatterns.RegExMaskPatterns.html +15 -0
  339. package/docs/variables/core_PositionContext.DimensionsContext.html +6 -0
  340. package/docs/variables/hooks_useScaledValue.kMillimeters2Inches.html +2 -0
  341. package/docs/variables/hooks_useScaledValue.kNewtons2Pounds.html +2 -0
  342. package/package.json +32 -27
  343. package/readme.md +193 -22
  344. package/src/components/AutoCoreDevPanel.tsx +411 -0
  345. package/src/components/CodeEditor.tsx +2 -2
  346. package/src/components/FileList.tsx +2 -2
  347. package/src/components/Indicator.tsx +2 -2
  348. package/src/components/IndicatorButton.tsx +2 -2
  349. package/src/components/IndicatorRect.tsx +2 -2
  350. package/src/components/Lamp.tsx +3 -3
  351. package/src/components/TextInput.tsx +159 -240
  352. package/src/components/ToggleGroup.tsx +3 -3
  353. package/src/components/ValueDisplay.tsx +4 -4
  354. package/src/components/ValueIndicator.tsx +2 -2
  355. package/src/components/ValueInput.tsx +2 -2
  356. package/src/core/AutoCoreTagContext.tsx +698 -0
  357. package/src/core/AutoCoreTagTypes.ts +202 -0
  358. package/src/core/EventEmitterContext.tsx +357 -43
  359. package/src/core/ValueSimulator.ts +2 -2
  360. package/src/hooks/useAutoCoreTag.ts +103 -0
  361. package/src/hub/HubBase.ts +3 -3
  362. package/src/hub/HubSimulate.ts +2 -2
  363. package/src/hub/HubTauri.ts +3 -3
  364. package/src/hub/HubWebSocket.ts +29 -32
  365. package/src/hub/index.ts +2 -2
  366. package/tsconfig.json +43 -28
  367. package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +0 -124
  368. package/docs/classes/components_ValueInput.ValueInput.html +0 -113
  369. package/docs/functions/assets_BlocklyLogo.default.html +0 -1
  370. package/docs/functions/assets_Distance.default.html +0 -1
  371. package/docs/functions/assets_JogLong.default.html +0 -1
  372. package/docs/functions/assets_JogMedium.default.html +0 -1
  373. package/docs/functions/assets_JogShort.default.html +0 -1
  374. package/docs/functions/assets_PythonLogo.default.html +0 -1
  375. package/docs/functions/assets_Rotation3D.default.html +0 -1
  376. package/docs/functions/assets_RotationCcw.default.html +0 -1
  377. package/docs/functions/assets_RotationCcwA.default.html +0 -1
  378. package/docs/functions/assets_RotationCcwB.default.html +0 -1
  379. package/docs/functions/assets_RotationCcwC.default.html +0 -1
  380. package/docs/functions/assets_RotationCw.default.html +0 -1
  381. package/docs/functions/assets_RotationCwA.default.html +0 -1
  382. package/docs/functions/assets_RotationCwB.default.html +0 -1
  383. package/docs/functions/assets_RotationCwC.default.html +0 -1
  384. package/docs/functions/assets_Run.default.html +0 -1
  385. package/docs/functions/assets_Speed.default.html +0 -1
  386. package/docs/functions/assets_SpeedFast.default.html +0 -1
  387. package/docs/functions/assets_SpeedMedium.default.html +0 -1
  388. package/docs/functions/assets_SpeedNone.default.html +0 -1
  389. package/docs/functions/assets_SpeedSlow.default.html +0 -1
  390. package/docs/functions/assets_Walk.default.html +0 -1
  391. package/docs/functions/components_FileList.FileList.html +0 -21
  392. package/docs/functions/components_FitText.FitText.html +0 -8
  393. package/docs/functions/components_ToggleGroup.ToggleGroup.html +0 -5
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @module core/AutoCoreTagTypes
3
+ *
4
+ * Core type system for AutoCore's tag layer:
5
+ * - Strongly-typed tag values (boolean/number/string/json)
6
+ * - Optional **scales** for numeric unit conversion (e.g., mm ⇄ in)
7
+ * - Optional **codecs** to present richer client-side types (Date/Map) while
8
+ * keeping pure JSON across the wire (serde_json::Value on the server)
9
+ */
10
+ export type PrimitiveKind = "boolean" | "number" | "string" | "json";
11
+ /** Strict JSON value (mirrors serde_json::Value) */
12
+ type JsonPrimitive = string | number | boolean | null;
13
+ export type JsonValue = JsonPrimitive | {
14
+ [key: string]: JsonValue;
15
+ } | JsonValue[];
16
+ /**
17
+ * Extended client-side value you *may* choose to present in the UI.
18
+ * Use codecs to round-trip these as pure JSON to the server.
19
+ */
20
+ export type ExtendedJsonValue = JsonValue | Date | Map<string, JsonValue>;
21
+ /**
22
+ * Map a tag's declared primitive kind to the app-visible type.
23
+ * - "json" becomes ExtendedJsonValue so UIs can work with Date/Map when desired.
24
+ */
25
+ export type TagValueOf<K extends PrimitiveKind> = K extends "boolean" ? boolean : K extends "number" ? number : K extends "string" ? string : ExtendedJsonValue;
26
+ /**
27
+ * Runtime binding for a single tag, as returned by hooks like `useAutoCoreTag`.
28
+ * - `value` is app-visible (already scaled/decoded)
29
+ * - `rawValue` is the last **unscaled, un-decoded** controller value received (server JSON)
30
+ * - `write` expects app-visible value (provider will inverse-scale/encode)
31
+ * - `tap` is typically for boolean momentaries (provider may pulse true→false)
32
+ */
33
+ export type TagBinding<T> = Readonly<{
34
+ /** App-visible value (scaled/decoded). */
35
+ value: T | undefined;
36
+ /** Last raw value from the server (pre-scale, pre-codec). */
37
+ rawValue: unknown | undefined;
38
+ /** Write a new app-visible value (provider will inverse-scale/encode). */
39
+ write: (displayValue: T) => Promise<void>;
40
+ /** Momentary action; typically boolean true→false pulse. */
41
+ tap: () => Promise<void>;
42
+ /** True while initial read/bootstrapping is in progress. */
43
+ isLoading: boolean;
44
+ }>;
45
+ /**
46
+ * Configuration for a named scale group.
47
+ * Apply by setting `scale: "<name>"` on numeric tags.
48
+ */
49
+ export interface ScaleConfig {
50
+ /** Unique name for this scale group (e.g., "position", "load") */
51
+ name: string;
52
+ /** Current scale factor — incoming values ×= scale; outgoing values /= scale */
53
+ scale: number;
54
+ /** Units/label for display (e.g., "mm", "in", "lbs") */
55
+ label: string;
56
+ /** Optional description for debugging/documentation */
57
+ description?: string;
58
+ /**
59
+ * Optional server tag that provides the scale dynamically.
60
+ * (If used, your provider should subscribe and update `scale` when it changes.)
61
+ */
62
+ serverTag?: {
63
+ domain: string;
64
+ symbolName: string;
65
+ };
66
+ }
67
+ /**
68
+ * A codec lets a tag expose a richer client-side type while staying JSON on the wire.
69
+ * Common examples:
70
+ * - Date values: ISO string ⇄ Date
71
+ * - Map-like blobs: object ⇄ Map<string, JsonValue>
72
+ */
73
+ export type TagCodec<TIn = unknown, TOut extends JsonValue = JsonValue> = {
74
+ /** raw JSON (from server) → app-visible value */
75
+ fromServer?: (raw: unknown) => TIn;
76
+ /** app-visible value → pure JSON (to server) */
77
+ toServer?: (value: TIn) => TOut;
78
+ };
79
+ /**
80
+ * Tag configuration descriptor used to build a typed spec.
81
+ *
82
+ * @typeParam K - Literal tag name (use `as const` on your spec array)
83
+ * @typeParam T - Primitive kind for type mapping (boolean/number/string/json)
84
+ */
85
+ export type TagConfig<K extends string = string, T extends PrimitiveKind = PrimitiveKind> = {
86
+ /** Local key used by UI/consumers (unique within your spec) */
87
+ tagName: K;
88
+ /** Domain for the symbol (e.g., "ADS", "MEMORYSTORE") */
89
+ domain: string;
90
+ /** Server symbol/topic name (as used by your backend invoke API) */
91
+ symbolName: string;
92
+ /** Declared primitive kind for typing and DevPanel rendering */
93
+ valueType: T;
94
+ /** Optional initial **raw** value before first server update */
95
+ initialValue?: TagValueOf<T>;
96
+ /** Optional per-tag hook/config options (e.g., cycle time, debounce) */
97
+ options?: Record<string, unknown>;
98
+ /**
99
+ * Optional scale group for numeric tags.
100
+ * If present, provider will:
101
+ * - Multiply incoming numbers by the group's `scale`
102
+ * - Divide outgoing numbers by the group's `scale`
103
+ */
104
+ scale?: string;
105
+ /**
106
+ * Optional codec to present richer UI types while keeping JSON on the wire.
107
+ * Only commonly used with `valueType: "json"`.
108
+ */
109
+ codec?: TagCodec;
110
+ };
111
+ /** Extract the tag config for a particular tag name `K` from a `Spec` */
112
+ export type ExtractByTag<Spec extends readonly TagConfig[], K> = Extract<Spec[number], {
113
+ tagName: K;
114
+ }>;
115
+ /**
116
+ * Build a strongly-typed map of tagName → app-visible value type.
117
+ * Use with `as const` specs to preserve literal tag names.
118
+ */
119
+ export type TagValueMap<Spec extends readonly TagConfig[]> = {
120
+ [K in Spec[number]["tagName"]]: TagValueOf<ExtractByTag<Spec, K>["valueType"]>;
121
+ };
122
+ /**
123
+ * Helper: binding type for a specific tag name from a spec.
124
+ */
125
+ export type BindingOf<Spec extends readonly TagConfig[], K extends Spec[number]["tagName"]> = TagBinding<TagValueMap<Spec>[K]>;
126
+ /**
127
+ * Enhanced context value with scale management.
128
+ * Providers should:
129
+ * - Buffer **raw** values in `rawValues` (pre-scale, pre-codec)
130
+ * - Populate `values` from `rawValues` using current scales/codecs
131
+ * - Inverse-scale/encode on write(t) before invoking backend
132
+ */
133
+ export interface BaseContextValue<VMap extends Record<string, any>> {
134
+ /** Current app-visible tag values (already scaled/decoded). */
135
+ values: Partial<VMap>;
136
+ /** Last raw (controller) values, as received (pre-scale, pre-codec). */
137
+ rawValues: Record<string, unknown>;
138
+ /** Whether initial reads are pending. */
139
+ isLoading: boolean;
140
+ /**
141
+ * Write a single tag value (app-visible → provider will inverse-scale/encode).
142
+ * Strongly typed by tag name when used with a typed Context.
143
+ */
144
+ write: <K extends keyof VMap & string>(tagName: K, value: VMap[K]) => Promise<void>;
145
+ /**
146
+ * Trigger a momentary/toggle action for a tag.
147
+ * Typically used for boolean "request" bits.
148
+ */
149
+ tap: <K extends keyof VMap & string>(tagName: K) => Promise<void>;
150
+ /** Current scale configurations by name. */
151
+ scales: Record<string, ScaleConfig>;
152
+ /**
153
+ * Update a scale group (factor and label). Providers should recompute affected tags from **raw**.
154
+ *
155
+ * @param scaleName - Name of the scale group (e.g., "position")
156
+ * @param newScale - New scale factor (display = raw * newScale)
157
+ * @param newLabel - New units label (e.g., "inches")
158
+ */
159
+ updateScale: (scaleName: string, newScale: number, newLabel: string) => Promise<void>;
160
+ }
161
+ export {};
162
+ //# sourceMappingURL=AutoCoreTagTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoCoreTagTypes.d.ts","sourceRoot":"","sources":["../../src/core/AutoCoreTagTypes.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE,oDAAoD;AACpD,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,GACjB,aAAa,GACb;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5B,SAAS,EAAE,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE1E;;;G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,CAAC,MAAM,EAAE,GAAG,CAAC;IAChE,+DAA+D;IAC/D,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,SAAS,MAAM,IAAI,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpF;;;OAGG;IACH,GAAG,EAAE,CAAC,CAAC,SAAS,MAAM,IAAI,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEpC;;;;;;OAMG;IACH,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvF"}
@@ -0,0 +1 @@
1
+ export{};
@@ -1,6 +1,298 @@
1
- import React, { ReactNode } from "react";
1
+ /**
2
+ * @fileoverview EventEmitterContext - Global Event Bus for AutoCore React Applications
3
+ *
4
+ * The EventEmitterContext provides a comprehensive event-driven communication system for React applications,
5
+ * enabling seamless interaction between components and backend services. It serves as the foundational layer
6
+ * for AutoCore's real-time data flow and component communication architecture.
7
+ *
8
+ * ## Core Features
9
+ *
10
+ * - **Global Event Bus**: Publish and subscribe to events across all components
11
+ * - **Backend Integration**: Direct communication with AutoCore server via Hub abstraction
12
+ * - **Type-Safe Subscriptions**: Strongly-typed event handling with automatic cleanup
13
+ * - **Connection Management**: Automatic reconnection and state synchronization
14
+ * - **Development Tools**: Built-in debugging and subscription introspection
15
+ *
16
+ * ## Architecture
17
+ *
18
+ * The system consists of three main components:
19
+ * 1. **EventEmitterProvider**: React context provider that manages global state
20
+ * 2. **Hub**: Abstraction layer for backend communication (WebSocket, HTTP, etc.)
21
+ * 3. **Subscription Manager**: Handles event routing and lifecycle management
22
+ *
23
+ * ## Basic Usage
24
+ *
25
+ * ### 1. Application Setup
26
+ *
27
+ * Wrap your entire application with the EventEmitterProvider:
28
+ *
29
+ * ```tsx
30
+ * // App.tsx
31
+ * import React from 'react';
32
+ * import { EventEmitterProvider } from '@adcops/autocore-react/core/EventEmitterContext';
33
+ * import { PrimeReactProvider } from 'primereact/api';
34
+ * import { MainView } from './MainView';
35
+ *
36
+ * export default function App() {
37
+ * return (
38
+ * <EventEmitterProvider>
39
+ * <PrimeReactProvider>
40
+ * <MainView />
41
+ * </PrimeReactProvider>
42
+ * </EventEmitterProvider>
43
+ * );
44
+ * }
45
+ * ```
46
+ *
47
+ * ### 2. Component Communication
48
+ *
49
+ * Use the context for inter-component communication:
50
+ *
51
+ * ```tsx
52
+ * // PublisherComponent.tsx
53
+ * import React, { useContext } from 'react';
54
+ * import { EventEmitterContext } from '@adcops/autocore-react/core/EventEmitterContext';
55
+ * import { Button } from 'primereact/button';
56
+ *
57
+ * export const PublisherComponent: React.FC = () => {
58
+ * const { dispatch } = useContext(EventEmitterContext);
59
+ *
60
+ * const handleButtonClick = () => {
61
+ * dispatch({
62
+ * topic: 'user-action/button-clicked',
63
+ * payload: { timestamp: Date.now(), buttonId: 'main-action' }
64
+ * });
65
+ * };
66
+ *
67
+ * return <Button label="Trigger Event" onClick={handleButtonClick} />;
68
+ * };
69
+ *
70
+ * // SubscriberComponent.tsx
71
+ * import React, { useContext, useEffect, useState } from 'react';
72
+ * import { EventEmitterContext } from '@adcops/autocore-react/core/EventEmitterContext';
73
+ *
74
+ * export const SubscriberComponent: React.FC = () => {
75
+ * const { subscribe, unsubscribe } = useContext(EventEmitterContext);
76
+ * const [lastAction, setLastAction] = useState<any>(null);
77
+ *
78
+ * useEffect(() => {
79
+ * const subscriptionId = subscribe('user-action/button-clicked', (payload) => {
80
+ * setLastAction(payload);
81
+ * console.log('Button clicked at:', payload.timestamp);
82
+ * });
83
+ *
84
+ * return () => unsubscribe(subscriptionId);
85
+ * }, [subscribe, unsubscribe]);
86
+ *
87
+ * return (
88
+ * <div>
89
+ * {lastAction && (
90
+ * <p>Last action: {new Date(lastAction.timestamp).toLocaleTimeString()}</p>
91
+ * )}
92
+ * </div>
93
+ * );
94
+ * };
95
+ * ```
96
+ *
97
+ * ### 3. Backend Integration
98
+ *
99
+ * Communicate with AutoCore server through the integrated Hub:
100
+ *
101
+ * ```tsx
102
+ * // ControlPanel.tsx
103
+ * import React, { useContext, useEffect, useState } from 'react';
104
+ * import { EventEmitterContext } from '@adcops/autocore-react/core/EventEmitterContext';
105
+ * import { Button } from 'primereact/button';
106
+ * import { InputNumber } from 'primereact/inputnumber';
107
+ *
108
+ * export const ControlPanel: React.FC = () => {
109
+ * const { invoke, subscribe, unsubscribe, isConnected } = useContext(EventEmitterContext);
110
+ * const [motorSpeed, setMotorSpeed] = useState<number>(0);
111
+ * const [targetSpeed, setTargetSpeed] = useState<number>(100);
112
+ * const [connected, setConnected] = useState<boolean>(false);
113
+ *
114
+ * // Monitor connection status
115
+ * useEffect(() => {
116
+ * setConnected(isConnected());
117
+ *
118
+ * const connectionSub = subscribe('HUB/connected', () => setConnected(true));
119
+ * const disconnectionSub = subscribe('HUB/disconnected', () => setConnected(false));
120
+ *
121
+ * return () => {
122
+ * unsubscribe(connectionSub);
123
+ * unsubscribe(disconnectionSub);
124
+ * };
125
+ * }, [subscribe, unsubscribe, isConnected]);
126
+ *
127
+ * // Subscribe to real-time motor speed updates
128
+ * useEffect(() => {
129
+ * const speedSub = subscribe('ADS/MAIN.motor.speed', (data) => {
130
+ * setMotorSpeed(data.value);
131
+ * });
132
+ *
133
+ * return () => unsubscribe(speedSub);
134
+ * }, [subscribe, unsubscribe]);
135
+ *
136
+ * // Send commands to backend
137
+ * const handleSpeedChange = async () => {
138
+ * try {
139
+ * const result = await invoke('ADS', 'write_value', {
140
+ * symbol_name: 'MAIN.motor.setpoint',
141
+ * value: targetSpeed
142
+ * });
143
+ *
144
+ * if (!result.success) {
145
+ * console.error('Failed to set motor speed:', result.error_message);
146
+ * }
147
+ * } catch (error) {
148
+ * console.error('Communication error:', error);
149
+ * }
150
+ * };
151
+ *
152
+ * const handleEmergencyStop = async () => {
153
+ * try {
154
+ * await invoke('ADS', 'emergency_stop', {});
155
+ * } catch (error) {
156
+ * console.error('Emergency stop failed:', error);
157
+ * }
158
+ * };
159
+ *
160
+ * return (
161
+ * <div className="control-panel">
162
+ * <div className="status">
163
+ * Connection: {connected ? '🟢 Connected' : '🔴 Disconnected'}
164
+ * </div>
165
+ *
166
+ * <div className="motor-control">
167
+ * <p>Current Speed: {motorSpeed} RPM</p>
168
+ *
169
+ * <InputNumber
170
+ * value={targetSpeed}
171
+ * onValueChange={(e) => setTargetSpeed(e.value || 0)}
172
+ * min={0}
173
+ * max={1000}
174
+ * suffix=" RPM"
175
+ * />
176
+ *
177
+ * <Button
178
+ * label="Set Speed"
179
+ * onClick={handleSpeedChange}
180
+ * disabled={!connected}
181
+ * />
182
+ *
183
+ * <Button
184
+ * label="Emergency Stop"
185
+ * onClick={handleEmergencyStop}
186
+ * severity="danger"
187
+ * disabled={!connected}
188
+ * />
189
+ * </div>
190
+ * </div>
191
+ * );
192
+ * };
193
+ * ```
194
+ *
195
+ * ### 4. Advanced Pattern: State Management Hook
196
+ *
197
+ * Create reusable hooks for common patterns:
198
+ *
199
+ * ```tsx
200
+ * // hooks/useRealtimeValue.ts
201
+ * import { useContext, useEffect, useState } from 'react';
202
+ * import { EventEmitterContext } from '@adcops/autocore-react/core/EventEmitterContext';
203
+ *
204
+ * export function useRealtimeValue<T>(topic: string, initialValue?: T) {
205
+ * const { subscribe, unsubscribe } = useContext(EventEmitterContext);
206
+ * const [value, setValue] = useState<T | undefined>(initialValue);
207
+ * const [lastUpdate, setLastUpdate] = useState<Date | null>(null);
208
+ *
209
+ * useEffect(() => {
210
+ * const subscriptionId = subscribe(topic, (data) => {
211
+ * setValue(data.value);
212
+ * setLastUpdate(new Date());
213
+ * });
214
+ *
215
+ * return () => unsubscribe(subscriptionId);
216
+ * }, [topic, subscribe, unsubscribe]);
217
+ *
218
+ * return { value, lastUpdate };
219
+ * }
220
+ *
221
+ * // Usage in component
222
+ * export const SensorDisplay: React.FC = () => {
223
+ * const { value: temperature } = useRealtimeValue<number>('ADS/sensors.temperature');
224
+ * const { value: pressure } = useRealtimeValue<number>('ADS/sensors.pressure');
225
+ *
226
+ * return (
227
+ * <div>
228
+ * <p>Temperature: {temperature?.toFixed(1)}°C</p>
229
+ * <p>Pressure: {pressure?.toFixed(2)} bar</p>
230
+ * </div>
231
+ * );
232
+ * };
233
+ * ```
234
+ *
235
+ * ## Integration with AutoCore Systems
236
+ *
237
+ * The EventEmitterContext is designed to work seamlessly with other AutoCore React components:
238
+ *
239
+ * ```tsx
240
+ * // Complete AutoCore application setup
241
+ * import React from 'react';
242
+ * import { EventEmitterProvider } from '@adcops/autocore-react/core/EventEmitterContext';
243
+ * import { AutoCoreTagProvider } from '@adcops/autocore-react/core/AutoCoreTagContext';
244
+ * import { PrimeReactProvider } from 'primereact/api';
245
+ * import { tagSpec } from './config/tags';
246
+ * import { MainInterface } from './components/MainInterface';
247
+ *
248
+ * export default function App() {
249
+ * return (
250
+ * <EventEmitterProvider>
251
+ * <AutoCoreTagProvider tags={tagSpec} eagerRead>
252
+ * <PrimeReactProvider>
253
+ * <MainInterface />
254
+ * </PrimeReactProvider>
255
+ * </AutoCoreTagProvider>
256
+ * </EventEmitterProvider>
257
+ * );
258
+ * }
259
+ * ```
260
+ *
261
+ * ## Best Practices
262
+ *
263
+ * 1. **Always Cleanup Subscriptions**: Use the cleanup function returned by useEffect
264
+ * 2. **Use Meaningful Topic Names**: Follow a hierarchical naming convention (e.g., 'domain/category/specific')
265
+ * 3. **Handle Connection States**: Always check connection status before invoking backend functions
266
+ * 4. **Error Handling**: Wrap invoke calls in try-catch blocks
267
+ * 5. **Type Safety**: Use TypeScript interfaces for payload structures
268
+ * 6. **Performance**: Avoid subscribing to high-frequency events in render-heavy components
269
+ *
270
+ * ## Debugging
271
+ *
272
+ * Use the built-in debugging features:
273
+ *
274
+ * ```tsx
275
+ * const { getSubscriptions, state } = useContext(EventEmitterContext);
276
+ *
277
+ * // View all subscriptions
278
+ * console.log('All subscriptions:', getSubscriptions());
279
+ *
280
+ * // View subscriptions for specific topic
281
+ * console.log('Motor subscriptions:', getSubscriptions('ADS/MAIN.motor.speed'));
282
+ *
283
+ * // View current state
284
+ * console.log('EventEmitter state:', state);
285
+ * ```
286
+ *
287
+ * @module core/EventEmitterContext
288
+ * @version 3.0.41
289
+ * @author Automated Design Corp.
290
+ * @since 1.0.0
291
+ */
292
+ import React from "react";
293
+ import type { ReactNode } from "react";
2
294
  import { Hub } from "../hub";
3
- import { CommandMessageResult } from "../hub/CommandMessage";
295
+ import type { CommandMessageResult } from "../hub/CommandMessage";
4
296
  export { Hub };
5
297
  /**
6
298
  * Represents an event subsription.
@@ -267,3 +559,4 @@ export declare const EventEmitterContext: React.Context<EventEmitterContextType>
267
559
  export declare const EventEmitterProvider: React.FC<{
268
560
  children: ReactNode;
269
561
  }>;
562
+ //# sourceMappingURL=EventEmitterContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEmitterContext.d.ts","sourceRoot":"","sources":["../../src/core/EventEmitterContext.tsx"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC;IAEpE;;;;OAIG;IACH,WAAW,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9C;;;OAGG;IACH,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAEhB;;;;OAIG;IACH,gBAAgB,EAAE,CAChB,KAAK,CAAC,EAAE,MAAM,KACX,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC;IAErD;;;OAGG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyHG;AACH,eAAO,MAAM,mBAAmB,wCA6B9B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAsIlE,CAAC"}
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{createContext,useState,useMemo,useCallback,useRef,useEffect}from"react";import{createHub,Hub}from"../hub";export{Hub};let globalSubscriptionId=1;export const EventEmitterContext=createContext({state:{subscriptions:{},nextSubscriptionId:1},dispatch:()=>{},subscribe:()=>0,invoke:async(t,e,s)=>Promise.resolve({data:{},success:!1,error_message:""}),unsubscribe:t=>{},hub:null,getSubscriptions:()=>[],isConnected:()=>!1});export const EventEmitterProvider=({children:t})=>{const[e,s]=useState({subscriptions:{},nextSubscriptionId:1}),r=useMemo((()=>createHub()),[]),c=useRef({});useEffect((()=>{c.current=e.subscriptions}),[e.subscriptions]);const o=useCallback((t=>{const{topic:e,payload:r}=t,o=c.current[e]?.slice()??[];for(const t of o)try{t.callback(r)}catch(t){}s((t=>({...t,eventData:r})))}),[]),n=useCallback(((t,e)=>{const r=++globalSubscriptionId,o=[...c.current[t]??[],{id:r,callback:e}];return c.current[t]=o,s((e=>({...e,subscriptions:{...e.subscriptions,[t]:o},nextSubscriptionId:globalSubscriptionId+1}))),r}),[]),i=useCallback((t=>{const e=c.current;for(const s of Object.keys(e)){const r=e[s].filter((e=>e.id!==t));r.length?e[s]=r:delete e[s]}s((t=>({...t,subscriptions:{...e}})))}),[]);import.meta&&import.meta.hot&&import.meta.hot.dispose((()=>{c.current={}}));const u=useMemo((()=>({state:e,dispatch:o,subscribe:n,unsubscribe:i,invoke:r.invoke,hub:r,getSubscriptions:t=>t?c.current[t]??[]:c.current,isConnected:r.isConnected})),[e,r,o,n,i]);return r.setContext(u),_jsx(EventEmitterContext.Provider,{value:u,children:t})};
1
+ import{jsx as _jsx}from"react/jsx-runtime";import React,{createContext,useState,useMemo,useCallback,useRef,useEffect}from"react";import{createHub,Hub}from"../hub";export{Hub};export const EventEmitterContext=createContext({state:{subscriptions:{},nextSubscriptionId:1},dispatch:()=>{},subscribe:()=>0,invoke:async(e,t,r)=>Promise.resolve({data:{},success:!1,error_message:""}),unsubscribe:e=>{},hub:null,getSubscriptions:()=>[],isConnected:()=>!1});export const EventEmitterProvider=({children:e})=>{const[t,r]=useState({subscriptions:{},nextSubscriptionId:1}),s=useMemo(()=>createHub(),[]),c=useRef(1),n=useRef({});useEffect(()=>{r(e=>({...e,subscriptions:{...n.current},nextSubscriptionId:c.current}))},[]);const o=useCallback(e=>{const{topic:t,payload:s}=e,c=n.current[t]?.slice()??[];for(const e of c)try{e.callback(s)}catch(e){}r(e=>({...e,eventData:s}))},[]),u=useCallback((e,t)=>{const s=c.current++,o={id:s,callback:t},u=[...n.current[e]??[],o];return n.current={...n.current,[e]:u},r(e=>({...e,subscriptions:{...n.current},nextSubscriptionId:c.current})),s},[]),i=useCallback(e=>{const t={};for(const[r,s]of Object.entries(n.current)){const c=s.filter(t=>t.id!==e);c.length>0&&(t[r]=c)}n.current=t,r(e=>({...e,subscriptions:{...t}}))},[]);useEffect(()=>()=>{n.current={},c.current=1},[]),import.meta&&import.meta.hot&&import.meta.hot.dispose(()=>{n.current={},c.current=1});const a=useMemo(()=>({state:t,dispatch:o,subscribe:u,unsubscribe:i,invoke:s.invoke,hub:s,getSubscriptions:e=>e?n.current[e]??[]:n.current,isConnected:s.isConnected}),[t,s,o,u,i]);return s.setContext(a),_jsx(EventEmitterContext.Provider,{value:a,children:e})};
@@ -19,3 +19,4 @@ export interface IndicatorButtonState {
19
19
  */
20
20
  isPressed: boolean;
21
21
  }
22
+ //# sourceMappingURL=IndicatorButtonState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndicatorButtonState.d.ts","sourceRoot":"","sources":["../../src/core/IndicatorButtonState.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAEzC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAG,OAAO,CAAC;CACvB"}
@@ -24,3 +24,4 @@ export declare enum IndicatorColor {
24
24
  /** Use for informational buttons. No other meaning allowed. */
25
25
  IndicatorInfo = "blue"
26
26
  }
27
+ //# sourceMappingURL=IndicatorColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndicatorColor.d.ts","sourceRoot":"","sources":["../../src/core/IndicatorColor.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,oBAAY,cAAc;IACtB,8CAA8C;IAC9C,cAAc,UAAU;IACxB,+EAA+E;IAC/E,WAAW,UAAiB;IAC5B,kCAAkC;IAClC,YAAY,SAAS;IACrB,uDAAuD;IACvD,YAAY,QAAQ;IACpB,8DAA8D;IAC9D,eAAe,WAAW;IAC1B,sDAAsD;IACtD,cAAc,QAAgB;IAC9B,yDAAyD;IACzD,gBAAgB,WAAkB;IAClC,wFAAwF;IACxF,gBAAgB,UAAU;IAC1B,4DAA4D;IAC5D,mBAAmB,SAAS;IAC5B,+DAA+D;IAC/D,aAAa,SAAS;CACzB"}
@@ -73,3 +73,4 @@ export declare const PrimeReactMaskPatterns: {
73
73
  /** International phone number with optional extension */
74
74
  readonly PhoneNumberIreland: "+353 99 999 9999 x99999";
75
75
  };
76
+ //# sourceMappingURL=MaskPatterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaskPatterns.d.ts","sourceRoot":"","sources":["../../src/core/MaskPatterns.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC1B;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAIH;;OAEG;;CAEG,CAAC;AAIX;;GAEG;AACH,eAAO,MAAM,sBAAsB;IAC/B,iCAAiC;;IAEjC,+CAA+C;;IAE/C,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;IAEzD,yDAAyD;;CAGnD,CAAC"}
@@ -56,3 +56,4 @@ type NumerableFormatNumberOptions = NumerableFormatParams[0][2];
56
56
  */
57
57
  export type NumerableFormatOptions = NonNullable<NumerableFormatNumberOptions>;
58
58
  export {};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AAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;CAAE,GACpE,KAAK,CAAC;AAEV;;;GAGG;AACH,KAAK,qBAAqB,GAAG,oBAAoB,CAAC,OAAO,MAAM,CAAC,CAAC;AAGjE;;;;GAIG;AACH,KAAK,4BAA4B,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAC"}
@@ -1 +1 @@
1
- export{};
1
+ import{format}from"numerable";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Interface representing the position and scale context of a component within its parent container.
4
3
  *
@@ -36,3 +35,4 @@ export interface IPositionContext {
36
35
  */
37
36
  export declare const DimensionsContext: import("react").Context<IPositionContext>;
38
37
  export default DimensionsContext;
38
+ //# sourceMappingURL=PositionContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PositionContext.d.ts","sourceRoot":"","sources":["../../src/core/PositionContext.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAE/B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,2CAI5B,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -14,3 +14,4 @@
14
14
  *
15
15
  */
16
16
  export declare function UniqueId(): string;
17
+ //# sourceMappingURL=UniqueId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UniqueId.d.ts","sourceRoot":"","sources":["../../src/core/UniqueId.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,IAAK,MAAM,CAElC"}
@@ -1,4 +1,4 @@
1
- import { EmitterDispatchFunction } from "./EventEmitterContext";
1
+ import type { EmitterDispatchFunction } from "./EventEmitterContext";
2
2
  /**
3
3
  * Generates values for simulating data into an HMI.
4
4
  * Used for demonstration and development testing.
@@ -69,3 +69,4 @@ export declare class ValueSimulator {
69
69
  protected updateTopic(topic: string, value: any): void;
70
70
  }
71
71
  export default ValueSimulator;
72
+ //# sourceMappingURL=ValueSimulator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValueSimulator.d.ts","sourceRoot":"","sources":["../../src/core/ValueSimulator.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGrE;;;GAGG;AACH,qBAAa,cAAc;IAEvB,SAAS,CAAC,KAAK,EAAE,OAAO,CAAS;IACjC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAQ;IAEhC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAK;IAC7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAK;IAC7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAK;IAC7B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAK;IAE7B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAC5B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAC5B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAC5B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAK;IAE5B,SAAS,CAAC,iBAAiB,EAAG,OAAO,CAAQ;IAC7C,SAAS,CAAC,iBAAiB,EAAG,OAAO,CAAQ;IAC7C,SAAS,CAAC,iBAAiB,EAAG,OAAO,CAAQ;IAC7C,SAAS,CAAC,iBAAiB,EAAG,OAAO,CAAQ;IAE7C,SAAS,CAAC,UAAU,EAAG,MAAM,CAA+B;IAC5D,SAAS,CAAC,UAAU,EAAG,MAAM,CAA+B;IAC5D,SAAS,CAAC,UAAU,EAAG,MAAM,CAAsC;IACnE,SAAS,CAAC,UAAU,EAAG,MAAM,CAAsC;IAEnE,SAAS,CAAC,UAAU,EAAE,MAAM,CAAK;IAEjC,SAAS,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAE5C;;;OAGG;gBACS,QAAQ,EAAE,uBAAuB;IAI7C;;OAEG;IACH,KAAK;IAWL;;OAEG;IACH,IAAI;IAQJ;;OAEG;IACH,SAAS,CAAC,MAAM;IA+BhB;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAYzF;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAOnG;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;CAQlD;AAED,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- export class ValueSimulator{constructor(i){Object.defineProperty(this,"bBit1",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"bBit2",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"iSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"fSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"fSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"intervalId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"dispatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dispatch=i}start(){0===this.intervalId&&(this.intervalId=setInterval((()=>this.update()),1e3))}stop(){0!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=0)}update(){this.bBit1=!this.bBit1,this.bBit2=!this.bBit2,[this.iRamp1,this.iRamp1DirectionUp]=this.updateRamp(this.iRamp1,this.iRamp1DirectionUp,32767),[this.iRamp2,this.iRamp2DirectionUp]=this.updateRamp(this.iRamp2,this.iRamp2DirectionUp,32767),[this.fRamp1,this.fRamp1DirectionUp]=this.updateRamp(this.fRamp1,this.fRamp1DirectionUp,3276.7),[this.fRamp2,this.fRamp2DirectionUp]=this.updateRamp(this.fRamp2,this.fRamp2DirectionUp,3276.7),[this.iSin1,this.iSin1Angle]=this.updateSin(this.iSin1,this.iSin1Angle,Math.PI/180,32767),[this.iSin2,this.iSin2Angle]=this.updateSin(this.iSin2,this.iSin2Angle,Math.PI/180,32767),[this.fSin1,this.fSin1Angle]=this.updateSin(this.fSin1,this.fSin1Angle,Math.PI/180,3276.7),[this.fSin2,this.fSin2Angle]=this.updateSin(this.fSin2,this.fSin2Angle,Math.PI/180,3276.7),this.updateTopic("value-simulator-bBit1",this.bBit1),this.updateTopic("value-simulator-bBit2",this.bBit2),this.updateTopic("value-simulator-iRamp1",this.iRamp1),this.updateTopic("value-simulator-iRamp2",this.iRamp2),this.updateTopic("value-simulator-fRamp1",this.fRamp1),this.updateTopic("value-simulator-fRamp2",this.fRamp2),this.updateTopic("value-simulator-iSin1",this.iSin1),this.updateTopic("value-simulator-iSin2",this.iSin2),this.updateTopic("value-simulator-fSin1",this.fSin1),this.updateTopic("value-simulator-fSin2",this.fSin2)}updateRamp(i,e,t){if(e){if(++i>=t)return[i,!1]}else if(--i<=0)return[i,!0];return[i,e]}updateSin(i,e,t,a){return e+=t,[Math.sin(e)*a,e]}updateTopic(i,e){this.dispatch({topic:i,payload:e})}}export default ValueSimulator;
1
+ export class ValueSimulator{constructor(i){Object.defineProperty(this,"bBit1",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"bBit2",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fRamp2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin1",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"fSin2",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"iRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp1DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"fRamp2DirectionUp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"iSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"iSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2}),Object.defineProperty(this,"fSin1Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"fSin2Angle",{enumerable:!0,configurable:!0,writable:!0,value:Math.random()*Math.PI*2/10}),Object.defineProperty(this,"intervalId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"dispatch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dispatch=i}start(){0===this.intervalId&&(this.intervalId=setInterval(()=>this.update(),1e3))}stop(){0!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=0)}update(){this.bBit1=!this.bBit1,this.bBit2=!this.bBit2,[this.iRamp1,this.iRamp1DirectionUp]=this.updateRamp(this.iRamp1,this.iRamp1DirectionUp,32767),[this.iRamp2,this.iRamp2DirectionUp]=this.updateRamp(this.iRamp2,this.iRamp2DirectionUp,32767),[this.fRamp1,this.fRamp1DirectionUp]=this.updateRamp(this.fRamp1,this.fRamp1DirectionUp,3276.7),[this.fRamp2,this.fRamp2DirectionUp]=this.updateRamp(this.fRamp2,this.fRamp2DirectionUp,3276.7),[this.iSin1,this.iSin1Angle]=this.updateSin(this.iSin1,this.iSin1Angle,Math.PI/180,32767),[this.iSin2,this.iSin2Angle]=this.updateSin(this.iSin2,this.iSin2Angle,Math.PI/180,32767),[this.fSin1,this.fSin1Angle]=this.updateSin(this.fSin1,this.fSin1Angle,Math.PI/180,3276.7),[this.fSin2,this.fSin2Angle]=this.updateSin(this.fSin2,this.fSin2Angle,Math.PI/180,3276.7),this.updateTopic("value-simulator-bBit1",this.bBit1),this.updateTopic("value-simulator-bBit2",this.bBit2),this.updateTopic("value-simulator-iRamp1",this.iRamp1),this.updateTopic("value-simulator-iRamp2",this.iRamp2),this.updateTopic("value-simulator-fRamp1",this.fRamp1),this.updateTopic("value-simulator-fRamp2",this.fRamp2),this.updateTopic("value-simulator-iSin1",this.iSin1),this.updateTopic("value-simulator-iSin2",this.iSin2),this.updateTopic("value-simulator-fSin1",this.fSin1),this.updateTopic("value-simulator-fSin2",this.fSin2)}updateRamp(i,e,t){if(e){if(++i>=t)return[i,!1]}else if(--i<=0)return[i,!0];return[i,e]}updateSin(i,e,t,a){return e+=t,[Math.sin(e)*a,e]}updateTopic(i,e){this.dispatch({topic:i,payload:e})}}export default ValueSimulator;
@@ -29,3 +29,4 @@ export type HocAddSubscriptionProps = {
29
29
  * @returns A component that subscribes to the given topic and updates its specified prop with the received data.
30
30
  */
31
31
  export declare function hocAddSubscription<P extends HocAddSubscriptionProps>(WrappedComponent: React.ComponentType<P>, topic: string, propName: keyof P): (props: Omit<P, keyof HocAddSubscriptionProps>) => import("react/jsx-runtime").JSX.Element;
32
+ //# sourceMappingURL=hoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hoc.d.ts","sourceRoot":"","sources":["../../src/core/hoc.tsx"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AAGH,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,uBAAuB,EAChE,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,CAAC,IAED,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,uBAAuB,CAAC,6CAchE"}
package/dist/core/hoc.js CHANGED
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import{EventEmitterContext}from"./EventEmitterContext";export function hocAddSubscription(t,e,r){return function(n){const[o,s]=useState(),{subscribe:u,unsubscribe:i}=useContext(EventEmitterContext);useEffect((()=>{const t=u(e,s);return()=>i(t)}),[e,u,i]);return _jsx(t,{...n,...{[r]:o}})}}
1
+ import{jsx as _jsx}from"react/jsx-runtime";import React,{useState,useEffect,useContext}from"react";import{EventEmitterContext}from"./EventEmitterContext";export function hocAddSubscription(t,e,r){return function(n){const[o,s]=useState(),{subscribe:u,unsubscribe:c}=useContext(EventEmitterContext);useEffect(()=>{const t=u(e,s);return()=>c(t)},[e,u,c]);return _jsx(t,{...n,...{[r]:o}})}}
@@ -143,3 +143,4 @@ export declare function useAdsWriteScaledValue(symbolName: string, scale: number
143
143
  * ```
144
144
  */
145
145
  export declare function useAdsTapValue(symbolName: string): () => Promise<void>;
146
+ //# sourceMappingURL=adsHooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adsHooks.d.ts","sourceRoot":"","sources":["../../src/hooks/adsHooks.tsx"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,qBAAqB,GAC9B,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,EAC7C,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAM,SAuDnC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,IAMjC,OAAO,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,mBAO1D;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAKnD,MAAM,mBAa1C;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CActE"}
@@ -1 +1 @@
1
- import{useContext,useRef,useEffect,useCallback}from"react";import{EventEmitterContext}from"../core/EventEmitterContext";function sleep(e){return new Promise((t=>setTimeout(t,e)))}export const useAdsRegisterSymbols=(e,t,n={})=>{const{invoke:r,subscribe:s,unsubscribe:o,isConnected:u}=useContext(EventEmitterContext),c=useRef([]),a=useRef(!0);return useEffect((()=>{a.current=!0;const i=async()=>{for(const[o,u]of Object.entries(t))try{const t=n[o]?{symbol_name:u,options:n[o]}:{symbol_name:u};await r("ADS","register_symbol",t);const i=s(`ADS/${u}`,(t=>{if(a.current){const n=e[o];n&&n(t.value)}}));c.current.push(i)}catch(e){}await r("ADS","refresh",{})};if(u())i();else{let e=s("HUB/connected",(()=>{i(),o(e)}));c.current.push(e)}return()=>{a.current=!1,c.current.forEach((e=>o(e))),c.current=[]}}),[]),null};export function useAdsWriteValue(e){const{invoke:t}=useContext(EventEmitterContext);return async n=>{try{await t("ADS","write_value",{symbol_name:e,value:n})}catch(e){}}}export function useAdsWriteScaledValue(e,t,n){const{invoke:r}=useContext(EventEmitterContext);return useCallback((async s=>{const o=(s-n)/t;try{await r("ADS","write_value",{symbol_name:e,value:o})}catch(e){}}),[e,t,n,r])}export function useAdsTapValue(e){const{invoke:t}=useContext(EventEmitterContext),n="write_value";return async()=>{try{await t("ADS",n,{symbol_name:e,value:!0}),await sleep(300),await t("ADS",n,{symbol_name:e,value:!1})}catch(e){}}}
1
+ import{useContext,useRef,useEffect,useCallback}from"react";import{EventEmitterContext}from"../core/EventEmitterContext";function sleep(e){return new Promise(t=>setTimeout(t,e))}export const useAdsRegisterSymbols=(e,t,n={})=>{const{invoke:r,subscribe:s,unsubscribe:o,isConnected:u}=useContext(EventEmitterContext),c=useRef([]),a=useRef(!0);return useEffect(()=>{a.current=!0;const i=async()=>{for(const[o,u]of Object.entries(t))try{const t=n[o]?{symbol_name:u,options:n[o]}:{symbol_name:u};await r("ADS","register_symbol",t);const i=s(`ADS/${u}`,t=>{if(a.current){const n=e[o];n&&n(t.value)}});c.current.push(i)}catch(e){}await r("ADS","refresh",{})};if(u())i();else{let e=s("HUB/connected",()=>{i(),o(e)});c.current.push(e)}return()=>{a.current=!1,c.current.forEach(e=>o(e)),c.current=[]}},[]),null};export function useAdsWriteValue(e){const{invoke:t}=useContext(EventEmitterContext);return async n=>{try{await t("ADS","write_value",{symbol_name:e,value:n})}catch(e){}}}export function useAdsWriteScaledValue(e,t,n){const{invoke:r}=useContext(EventEmitterContext);return useCallback(async s=>{const o=(s-n)/t;try{await r("ADS","write_value",{symbol_name:e,value:o})}catch(e){}},[e,t,n,r])}export function useAdsTapValue(e){const{invoke:t}=useContext(EventEmitterContext),n="write_value";return async()=>{try{await t("ADS",n,{symbol_name:e,value:!0}),await sleep(300),await t("ADS",n,{symbol_name:e,value:!1})}catch(e){}}}