@adcops/autocore-react 3.0.40 → 3.3.2

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 (296) hide show
  1. package/additional-docs/AutoCoreTagContext.md +441 -0
  2. package/additional-docs/react_performance_notes.md +94 -0
  3. package/dist/assets/BlocklyLogo.d.ts +1 -0
  4. package/dist/assets/BlocklyLogo.d.ts.map +1 -0
  5. package/dist/assets/Distance.d.ts +1 -0
  6. package/dist/assets/Distance.d.ts.map +1 -0
  7. package/dist/assets/JogLong.d.ts +1 -0
  8. package/dist/assets/JogLong.d.ts.map +1 -0
  9. package/dist/assets/JogMedium.d.ts +1 -0
  10. package/dist/assets/JogMedium.d.ts.map +1 -0
  11. package/dist/assets/JogShort.d.ts +1 -0
  12. package/dist/assets/JogShort.d.ts.map +1 -0
  13. package/dist/assets/PythonLogo.d.ts +1 -0
  14. package/dist/assets/PythonLogo.d.ts.map +1 -0
  15. package/dist/assets/Rotation3D.d.ts +1 -0
  16. package/dist/assets/Rotation3D.d.ts.map +1 -0
  17. package/dist/assets/RotationCcw.d.ts +1 -0
  18. package/dist/assets/RotationCcw.d.ts.map +1 -0
  19. package/dist/assets/RotationCcwA.d.ts +1 -0
  20. package/dist/assets/RotationCcwA.d.ts.map +1 -0
  21. package/dist/assets/RotationCcwB.d.ts +1 -0
  22. package/dist/assets/RotationCcwB.d.ts.map +1 -0
  23. package/dist/assets/RotationCcwC.d.ts +1 -0
  24. package/dist/assets/RotationCcwC.d.ts.map +1 -0
  25. package/dist/assets/RotationCw.d.ts +1 -0
  26. package/dist/assets/RotationCw.d.ts.map +1 -0
  27. package/dist/assets/RotationCwA.d.ts +1 -0
  28. package/dist/assets/RotationCwA.d.ts.map +1 -0
  29. package/dist/assets/RotationCwB.d.ts +1 -0
  30. package/dist/assets/RotationCwB.d.ts.map +1 -0
  31. package/dist/assets/RotationCwC.d.ts +1 -0
  32. package/dist/assets/RotationCwC.d.ts.map +1 -0
  33. package/dist/assets/Run.d.ts +1 -0
  34. package/dist/assets/Run.d.ts.map +1 -0
  35. package/dist/assets/Speed.d.ts +1 -0
  36. package/dist/assets/Speed.d.ts.map +1 -0
  37. package/dist/assets/SpeedFast.d.ts +1 -0
  38. package/dist/assets/SpeedFast.d.ts.map +1 -0
  39. package/dist/assets/SpeedMedium.d.ts +1 -0
  40. package/dist/assets/SpeedMedium.d.ts.map +1 -0
  41. package/dist/assets/SpeedNone.d.ts +1 -0
  42. package/dist/assets/SpeedNone.d.ts.map +1 -0
  43. package/dist/assets/SpeedSlow.d.ts +1 -0
  44. package/dist/assets/SpeedSlow.d.ts.map +1 -0
  45. package/dist/assets/Walk.d.ts +1 -0
  46. package/dist/assets/Walk.d.ts.map +1 -0
  47. package/dist/assets/index.d.ts +1 -0
  48. package/dist/assets/index.d.ts.map +1 -0
  49. package/dist/components/AutoCoreDevPanel.d.ts +144 -0
  50. package/dist/components/AutoCoreDevPanel.d.ts.map +1 -0
  51. package/dist/components/AutoCoreDevPanel.js +1 -0
  52. package/dist/components/BlocklyEditor.d.ts +1 -0
  53. package/dist/components/BlocklyEditor.d.ts.map +1 -0
  54. package/dist/components/BlocklyEditor.js +1 -1
  55. package/dist/components/CodeEditor.d.ts +2 -1
  56. package/dist/components/CodeEditor.d.ts.map +1 -0
  57. package/dist/components/CodeEditor.js +1 -1
  58. package/dist/components/FileList.d.ts +1 -0
  59. package/dist/components/FileList.d.ts.map +1 -0
  60. package/dist/components/FileList.js +1 -1
  61. package/dist/components/FileSelect.d.ts +1 -0
  62. package/dist/components/FileSelect.d.ts.map +1 -0
  63. package/dist/components/FileSelect.js +1 -1
  64. package/dist/components/FitText.d.ts +1 -0
  65. package/dist/components/FitText.d.ts.map +1 -0
  66. package/dist/components/FitText.js +1 -1
  67. package/dist/components/Indicator.d.ts +2 -1
  68. package/dist/components/Indicator.d.ts.map +1 -0
  69. package/dist/components/Indicator.js +1 -1
  70. package/dist/components/IndicatorButton.d.ts +2 -1
  71. package/dist/components/IndicatorButton.d.ts.map +1 -0
  72. package/dist/components/IndicatorButton.js +1 -1
  73. package/dist/components/IndicatorRect.d.ts +2 -1
  74. package/dist/components/IndicatorRect.d.ts.map +1 -0
  75. package/dist/components/JogPanel.d.ts +1 -0
  76. package/dist/components/JogPanel.d.ts.map +1 -0
  77. package/dist/components/Lamp.d.ts +2 -1
  78. package/dist/components/Lamp.d.ts.map +1 -0
  79. package/dist/components/Lamp.js +1 -1
  80. package/dist/components/Osk.d.ts +1 -0
  81. package/dist/components/Osk.d.ts.map +1 -0
  82. package/dist/components/Osk.js +1 -1
  83. package/dist/components/OskDialog.d.ts +1 -0
  84. package/dist/components/OskDialog.d.ts.map +1 -0
  85. package/dist/components/ProgressBarWithValue.d.ts +1 -0
  86. package/dist/components/ProgressBarWithValue.d.ts.map +1 -0
  87. package/dist/components/ProgressBarWithValue.js +1 -1
  88. package/dist/components/TextInput.d.ts +62 -103
  89. package/dist/components/TextInput.d.ts.map +1 -0
  90. package/dist/components/TextInput.js +1 -1
  91. package/dist/components/ToggleGroup.d.ts +2 -1
  92. package/dist/components/ToggleGroup.d.ts.map +1 -0
  93. package/dist/components/ToggleGroup.js +1 -1
  94. package/dist/components/ValueDisplay.d.ts +3 -2
  95. package/dist/components/ValueDisplay.d.ts.map +1 -0
  96. package/dist/components/ValueDisplay.js +1 -1
  97. package/dist/components/ValueIndicator.d.ts +2 -1
  98. package/dist/components/ValueIndicator.d.ts.map +1 -0
  99. package/dist/components/ValueIndicator.js +1 -1
  100. package/dist/components/ValueInput.d.ts +2 -1
  101. package/dist/components/ValueInput.d.ts.map +1 -0
  102. package/dist/components/ValueInput.js +1 -1
  103. package/dist/core/ActionMode.d.ts +1 -0
  104. package/dist/core/ActionMode.d.ts.map +1 -0
  105. package/dist/core/AutoCoreTagContext.d.ts +98 -0
  106. package/dist/core/AutoCoreTagContext.d.ts.map +1 -0
  107. package/dist/core/AutoCoreTagContext.js +1 -0
  108. package/dist/core/AutoCoreTagTypes.d.ts +283 -0
  109. package/dist/core/AutoCoreTagTypes.d.ts.map +1 -0
  110. package/dist/core/AutoCoreTagTypes.js +1 -0
  111. package/dist/core/CoreStreamTypes.d.ts +345 -0
  112. package/dist/core/CoreStreamTypes.d.ts.map +1 -0
  113. package/dist/core/CoreStreamTypes.js +1 -0
  114. package/dist/core/EventEmitterContext.d.ts +113 -202
  115. package/dist/core/EventEmitterContext.d.ts.map +1 -0
  116. package/dist/core/EventEmitterContext.js +1 -1
  117. package/dist/core/IndicatorButtonState.d.ts +1 -0
  118. package/dist/core/IndicatorButtonState.d.ts.map +1 -0
  119. package/dist/core/IndicatorColor.d.ts +1 -0
  120. package/dist/core/IndicatorColor.d.ts.map +1 -0
  121. package/dist/core/MaskPatterns.d.ts +1 -0
  122. package/dist/core/MaskPatterns.d.ts.map +1 -0
  123. package/dist/core/NumerableTypes.d.ts +1 -0
  124. package/dist/core/NumerableTypes.d.ts.map +1 -0
  125. package/dist/core/NumerableTypes.js +1 -1
  126. package/dist/core/PositionContext.d.ts +1 -1
  127. package/dist/core/PositionContext.d.ts.map +1 -0
  128. package/dist/core/UniqueId.d.ts +1 -0
  129. package/dist/core/UniqueId.d.ts.map +1 -0
  130. package/dist/core/ValueSimulator.d.ts +2 -1
  131. package/dist/core/ValueSimulator.d.ts.map +1 -0
  132. package/dist/core/ValueSimulator.js +1 -1
  133. package/dist/core/hoc.d.ts +1 -0
  134. package/dist/core/hoc.d.ts.map +1 -0
  135. package/dist/core/hoc.js +1 -1
  136. package/dist/hooks/adsHooks.d.ts +1 -0
  137. package/dist/hooks/adsHooks.d.ts.map +1 -0
  138. package/dist/hooks/adsHooks.js +1 -1
  139. package/dist/hooks/commandHooks.d.ts +4 -3
  140. package/dist/hooks/commandHooks.d.ts.map +1 -0
  141. package/dist/hooks/commandHooks.js +1 -1
  142. package/dist/hooks/index.d.ts +1 -0
  143. package/dist/hooks/index.d.ts.map +1 -0
  144. package/dist/hooks/useAutoCoreTag.d.ts +26 -0
  145. package/dist/hooks/useAutoCoreTag.d.ts.map +1 -0
  146. package/dist/hooks/useAutoCoreTag.js +1 -0
  147. package/dist/hooks/useScaledValue.d.ts +1 -0
  148. package/dist/hooks/useScaledValue.d.ts.map +1 -0
  149. package/dist/hooks/useScaledValue.js +1 -1
  150. package/dist/hub/CommandMessage.d.ts +19 -9
  151. package/dist/hub/CommandMessage.d.ts.map +1 -0
  152. package/dist/hub/CommandMessage.js +1 -1
  153. package/dist/hub/DebugPanel.d.ts +31 -0
  154. package/dist/hub/DebugPanel.d.ts.map +1 -0
  155. package/dist/hub/DebugPanel.js +1 -0
  156. package/dist/hub/HubBase.d.ts +85 -130
  157. package/dist/hub/HubBase.d.ts.map +1 -0
  158. package/dist/hub/HubBase.js +1 -1
  159. package/dist/hub/HubSimulate.d.ts +42 -8
  160. package/dist/hub/HubSimulate.d.ts.map +1 -0
  161. package/dist/hub/HubSimulate.js +1 -1
  162. package/dist/hub/HubTauri.d.ts +25 -60
  163. package/dist/hub/HubTauri.d.ts.map +1 -0
  164. package/dist/hub/HubTauri.js +1 -1
  165. package/dist/hub/HubWebSocket.d.ts +34 -17
  166. package/dist/hub/HubWebSocket.d.ts.map +1 -0
  167. package/dist/hub/HubWebSocket.js +1 -1
  168. package/dist/hub/debug.d.ts +23 -0
  169. package/dist/hub/debug.d.ts.map +1 -0
  170. package/dist/hub/debug.js +1 -0
  171. package/dist/hub/index.d.ts +20 -4
  172. package/dist/hub/index.d.ts.map +1 -0
  173. package/dist/hub/index.js +1 -1
  174. package/package.json +32 -27
  175. package/readme.md +193 -22
  176. package/src/components/AutoCoreDevPanel.tsx +414 -0
  177. package/src/components/CodeEditor.tsx +2 -2
  178. package/src/components/FileList.tsx +7 -6
  179. package/src/components/FileSelect.tsx +2 -1
  180. package/src/components/Indicator.tsx +2 -2
  181. package/src/components/IndicatorButton.tsx +2 -2
  182. package/src/components/IndicatorRect.tsx +2 -2
  183. package/src/components/Lamp.tsx +3 -3
  184. package/src/components/TextInput.tsx +159 -240
  185. package/src/components/ToggleGroup.tsx +3 -3
  186. package/src/components/ValueDisplay.tsx +4 -4
  187. package/src/components/ValueIndicator.tsx +2 -2
  188. package/src/components/ValueInput.tsx +2 -2
  189. package/src/core/ActionMode.ts +1 -1
  190. package/src/core/AutoCoreTagContext.tsx +615 -0
  191. package/src/core/AutoCoreTagTypes.ts +334 -0
  192. package/src/core/CoreStreamTypes.ts +512 -0
  193. package/src/core/EventEmitterContext.tsx +257 -281
  194. package/src/core/IndicatorButtonState.ts +1 -1
  195. package/src/core/ValueSimulator.ts +2 -2
  196. package/src/core/hoc.tsx +1 -1
  197. package/src/hooks/adsHooks.tsx +21 -22
  198. package/src/hooks/commandHooks.tsx +23 -19
  199. package/src/hooks/index.ts +1 -1
  200. package/src/hooks/useAutoCoreTag.ts +103 -0
  201. package/src/hooks/useScaledValue.tsx +1 -1
  202. package/src/hub/CommandMessage.ts +71 -19
  203. package/src/hub/DebugPanel.ts +280 -0
  204. package/src/hub/HubBase.ts +147 -223
  205. package/src/hub/HubSimulate.ts +93 -24
  206. package/src/hub/HubTauri.ts +87 -96
  207. package/src/hub/HubWebSocket.ts +133 -158
  208. package/src/hub/debug.ts +211 -0
  209. package/src/hub/index.ts +49 -39
  210. package/tsconfig.json +43 -28
  211. package/docs/classes/components_BlocklyEditor.BlocklyEditor.html +0 -124
  212. package/docs/classes/components_CodeEditor.CodeEditor.html +0 -128
  213. package/docs/classes/components_JogPanel.JogPanel.html +0 -138
  214. package/docs/classes/components_Lamp.Lamp.html +0 -105
  215. package/docs/classes/components_TextInput.TextInput.html +0 -115
  216. package/docs/classes/components_ValueIndicator.ValueIndicator.html +0 -119
  217. package/docs/classes/components_ValueInput.ValueInput.html +0 -113
  218. package/docs/classes/hub_HubWebSocket.HubWebSocket.html +0 -106
  219. package/docs/enums/components_JogPanel.JogDistanceAction.html +0 -5
  220. package/docs/enums/components_JogPanel.JogPanelAction.html +0 -18
  221. package/docs/enums/components_JogPanel.JogSpeedAction.html +0 -5
  222. package/docs/enums/core_ActionMode.ActionMode.html +0 -6
  223. package/docs/enums/core_IndicatorColor.IndicatorColor.html +0 -23
  224. package/docs/functions/assets_BlocklyLogo.default.html +0 -1
  225. package/docs/functions/assets_Distance.default.html +0 -1
  226. package/docs/functions/assets_JogLong.default.html +0 -1
  227. package/docs/functions/assets_JogMedium.default.html +0 -1
  228. package/docs/functions/assets_JogShort.default.html +0 -1
  229. package/docs/functions/assets_PythonLogo.default.html +0 -1
  230. package/docs/functions/assets_Rotation3D.default.html +0 -1
  231. package/docs/functions/assets_RotationCcw.default.html +0 -1
  232. package/docs/functions/assets_RotationCcwA.default.html +0 -1
  233. package/docs/functions/assets_RotationCcwB.default.html +0 -1
  234. package/docs/functions/assets_RotationCcwC.default.html +0 -1
  235. package/docs/functions/assets_RotationCw.default.html +0 -1
  236. package/docs/functions/assets_RotationCwA.default.html +0 -1
  237. package/docs/functions/assets_RotationCwB.default.html +0 -1
  238. package/docs/functions/assets_RotationCwC.default.html +0 -1
  239. package/docs/functions/assets_Run.default.html +0 -1
  240. package/docs/functions/assets_Speed.default.html +0 -1
  241. package/docs/functions/assets_SpeedFast.default.html +0 -1
  242. package/docs/functions/assets_SpeedMedium.default.html +0 -1
  243. package/docs/functions/assets_SpeedNone.default.html +0 -1
  244. package/docs/functions/assets_SpeedSlow.default.html +0 -1
  245. package/docs/functions/assets_Walk.default.html +0 -1
  246. package/docs/functions/components_BlocklyEditor.createCustomToolbox.html +0 -6
  247. package/docs/functions/components_FileList.FileList.html +0 -21
  248. package/docs/functions/components_FitText.FitText.html +0 -8
  249. package/docs/functions/components_ToggleGroup.ToggleGroup.html +0 -5
  250. package/docs/interfaces/components_JogPanel.JogPanelButtonDefinition.html +0 -5
  251. package/docs/interfaces/components_ToggleGroup.ToggleGroupProps.html +0 -618
  252. package/docs/interfaces/core_IndicatorButtonState.IndicatorButtonState.html +0 -10
  253. package/docs/interfaces/hub_CommandMessage.CommandMessage.html +0 -6
  254. package/docs/interfaces/hub_CommandMessage.CommandMessageResult.html +0 -4
  255. package/docs/modules/assets.html +0 -23
  256. package/docs/modules/assets_BlocklyLogo.html +0 -2
  257. package/docs/modules/assets_Distance.html +0 -2
  258. package/docs/modules/assets_JogLong.html +0 -2
  259. package/docs/modules/assets_JogMedium.html +0 -2
  260. package/docs/modules/assets_JogShort.html +0 -2
  261. package/docs/modules/assets_PythonLogo.html +0 -2
  262. package/docs/modules/assets_Rotation3D.html +0 -2
  263. package/docs/modules/assets_RotationCcw.html +0 -2
  264. package/docs/modules/assets_RotationCcwA.html +0 -2
  265. package/docs/modules/assets_RotationCcwB.html +0 -2
  266. package/docs/modules/assets_RotationCcwC.html +0 -2
  267. package/docs/modules/assets_RotationCw.html +0 -2
  268. package/docs/modules/assets_RotationCwA.html +0 -2
  269. package/docs/modules/assets_RotationCwB.html +0 -2
  270. package/docs/modules/assets_RotationCwC.html +0 -2
  271. package/docs/modules/assets_Run.html +0 -2
  272. package/docs/modules/assets_Speed.html +0 -2
  273. package/docs/modules/assets_SpeedFast.html +0 -2
  274. package/docs/modules/assets_SpeedMedium.html +0 -2
  275. package/docs/modules/assets_SpeedNone.html +0 -2
  276. package/docs/modules/assets_SpeedSlow.html +0 -2
  277. package/docs/modules/assets_Walk.html +0 -2
  278. package/docs/modules/components_BlocklyEditor.html +0 -5
  279. package/docs/modules/components_CodeEditor.html +0 -3
  280. package/docs/modules/components_FileList.html +0 -3
  281. package/docs/modules/components_FitText.html +0 -3
  282. package/docs/modules/components_JogPanel.html +0 -9
  283. package/docs/modules/components_Lamp.html +0 -4
  284. package/docs/modules/components_TextInput.html +0 -2
  285. package/docs/modules/components_ToggleGroup.html +0 -6
  286. package/docs/modules/components_ValueIndicator.html +0 -4
  287. package/docs/modules/components_ValueInput.html +0 -2
  288. package/docs/modules/core_ActionMode.html +0 -2
  289. package/docs/modules/core_IndicatorButtonState.html +0 -2
  290. package/docs/modules/core_IndicatorColor.html +0 -2
  291. package/docs/modules/hub_CommandMessage.html +0 -3
  292. package/docs/modules/hub_HubWebSocket.html +0 -2
  293. package/docs/types/components_IndicatorButton.IndicatorButtonOptionsType.html +0 -1
  294. package/docs/variables/components_BlocklyEditor.StandardToolbox.html +0 -1
  295. package/docs/variables/components_JogPanel.DefaultLinearJogButtons.html +0 -2
  296. package/docs/variables/components_JogPanel.DefaultRotationJogButtons.html +0 -2
@@ -0,0 +1,414 @@
1
+ /*
2
+ * Copyright (C) 2025 Automated Design Corp.. All Rights Reserved.
3
+ * Created Date: 2025-09-05 08:06:09
4
+ * -----
5
+ * Last Modified: 2026-01-20 06:09:05
6
+ * -----
7
+ *
8
+ */
9
+
10
+ /**
11
+ * @module components/AutoCoreDevPanel
12
+ *
13
+ * @summary
14
+ *
15
+ * A development and debugging panel for monitoring and manually interacting with AutoCore tags.
16
+ * This component provides real-time visibility into tag values and allows direct manipulation
17
+ * for testing and debugging purposes.
18
+ *
19
+ * @remarks
20
+ *
21
+ * The AutoCoreDevPanel is designed to be used during development to:
22
+ * - Monitor live tag values in real-time
23
+ * - Test write operations manually
24
+ * - Debug tag behavior and connectivity
25
+ * - Perform tap operations on boolean tags
26
+ * - Validate tag configurations
27
+ *
28
+ * The panel automatically connects to the global AutoCoreTagContext and displays all
29
+ * tags passed to it. No additional setup or factory functions are required.
30
+ *
31
+ * @example Basic Usage
32
+ * ```tsx
33
+ * import React from 'react';
34
+ * import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
35
+ * import { acTagSpec } from "./AutoCoreTags";
36
+ *
37
+ * function App() {
38
+ * return (
39
+ * <div>
40
+ * <main>
41
+ * <YourMainContent />
42
+ * </main>
43
+ *
44
+ * {process.env.NODE_ENV === 'development' && (
45
+ * <AutoCoreDevPanel
46
+ * tags={acTagSpec}
47
+ * className="fixed bottom-4 right-4 bg-white shadow-lg"
48
+ * />
49
+ * )}
50
+ * </div>
51
+ * );
52
+ * }
53
+ * ```
54
+ *
55
+ * @example Styled Panel
56
+ * ```tsx
57
+ * import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
58
+ * import { acTagSpec } from "./AutoCoreTags";
59
+ *
60
+ * // Custom styled panel
61
+ * <AutoCoreDevPanel
62
+ * tags={acTagSpec}
63
+ * title="Machine Status Monitor"
64
+ * className="
65
+ * fixed top-4 left-4
66
+ * bg-gray-900 text-white
67
+ * border border-gray-700
68
+ * shadow-2xl rounded-lg
69
+ * max-w-md
70
+ * "
71
+ * />
72
+ * ```
73
+ *
74
+ * @example Filtered Tags
75
+ * ```tsx
76
+ * import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
77
+ * import { acTagSpec } from "./AutoCoreTags";
78
+ *
79
+ * // Show only specific tags for focused debugging
80
+ * const motorTags = acTagSpec.filter(tag =>
81
+ * tag.tagName.includes('motor') || tag.tagName.includes('axis')
82
+ * );
83
+ *
84
+ * <AutoCoreDevPanel
85
+ * tags={motorTags}
86
+ * title="Motor Control Debug"
87
+ * className="debug-panel"
88
+ * />
89
+ * ```
90
+ */
91
+
92
+ import React, { useContext, useMemo, useState, useCallback } from "react";
93
+ import type { TagConfig } from "../core/AutoCoreTagTypes";
94
+ import { AutoCoreTagContext } from "../core/AutoCoreTagContext";
95
+
96
+ /** Extract domain (first segment) from FQDN */
97
+ const getDomain = (fqdn: string): string => fqdn.split('.')[0];
98
+
99
+ /**
100
+ * Props for the AutoCoreDevPanel component.
101
+ */
102
+ interface AutoCoreDevPanelProps {
103
+ /**
104
+ * Array of tag configurations to display in the panel.
105
+ * Each tag will show its current value and provide controls for writing new values.
106
+ */
107
+ tags: readonly TagConfig[];
108
+
109
+ /**
110
+ * Optional title for the panel header.
111
+ * @defaultValue "AutoCore Dev Panel"
112
+ */
113
+ title?: string;
114
+
115
+ /**
116
+ * Optional CSS class names for custom styling.
117
+ * The panel has default styling but can be customized with Tailwind or custom CSS.
118
+ */
119
+ className?: string;
120
+ }
121
+
122
+ /**
123
+ * AutoCoreDevPanel - Development and debugging panel for AutoCore tags.
124
+ *
125
+ * This component provides a real-time debugging interface for monitoring and manipulating
126
+ * AutoCore tags during development. It displays current tag values, provides input controls
127
+ * for writing new values, and includes tap functionality for boolean tags.
128
+ *
129
+ * ## Features
130
+ *
131
+ * - **Real-time monitoring**: Shows live tag values as they update from the server
132
+ * - **Direct writes**: Input controls to write new values directly to tags
133
+ * - **Type-aware inputs**: Automatically provides appropriate input types (checkbox for boolean, number input for numeric, etc.)
134
+ * - **Tap functionality**: Special "TAP" buttons for boolean tags that send momentary true→false signals
135
+ * - **Error handling**: Visual feedback for write failures and validation errors
136
+ * - **Live status**: Indicator showing whether the system is loading or live
137
+ * - **JSON support**: Proper formatting and editing for JSON-type tags
138
+ *
139
+ * ## Input Types
140
+ *
141
+ * - **Boolean tags**: Checkbox for direct true/false setting + TAP button for momentary signals
142
+ * - **Number tags**: Number input with validation
143
+ * - **String tags**: Text input
144
+ * - **JSON tags**: Text input with JSON validation and pretty-printing
145
+ *
146
+ * ## Keyboard Shortcuts
147
+ *
148
+ * - **Enter key**: In text/number inputs, immediately sends the value to the server
149
+ * - **Tab navigation**: Navigate between inputs using standard keyboard navigation
150
+ *
151
+ * ## Error Handling
152
+ *
153
+ * Write operations that fail will show error messages below the input field.
154
+ * Common errors include:
155
+ * - Invalid number formats
156
+ * - Malformed JSON
157
+ * - Network/server errors
158
+ * - Tag not found errors
159
+ */
160
+ export const AutoCoreDevPanel: React.FC<AutoCoreDevPanelProps> = ({
161
+ tags,
162
+ title = "AutoCore Dev Panel",
163
+ className = "",
164
+ }) => {
165
+ const { values, rawValues, isLoading, write, tap, scales } = useContext(AutoCoreTagContext);
166
+
167
+ /** Local editable buffers & errors keyed by tagName */
168
+ const [editBuf, setEditBuf] = useState<Record<string, string>>({});
169
+ const [errors, setErrors] = useState<Record<string, string>>({});
170
+
171
+ const rows = useMemo(() => {
172
+ return tags.map((tag) => {
173
+ const display = values[tag.fqdn];
174
+ const raw = rawValues[tag.fqdn];
175
+ const scaleName = tag.scale ?? "";
176
+ const s = scaleName ? scales[scaleName] : undefined;
177
+ return {
178
+ tag,
179
+ display,
180
+ raw,
181
+ scaleName,
182
+ factor: s?.scale,
183
+ label: s?.label,
184
+ };
185
+ });
186
+ }, [tags, values, rawValues, scales]);
187
+
188
+ const setBuf = useCallback((tagName: string, v: string) => {
189
+ setEditBuf((prev) => ({ ...prev, [tagName]: v }));
190
+ setErrors((prev) => ({ ...prev, [tagName]: "" }));
191
+ }, []);
192
+
193
+ const setErr = useCallback((tagName: string, msg: string) => {
194
+ setErrors((prev) => ({ ...prev, [tagName]: msg }));
195
+ }, []);
196
+
197
+ const commit = useCallback(async (tag: TagConfig) => {
198
+ const tagName = tag.fqdn;
199
+ const buf = editBuf[tagName];
200
+
201
+ try {
202
+ if (tag.valueType === "boolean") {
203
+ // Toggle to the buffer value if explicitly provided, else flip current
204
+ const desired =
205
+ buf === "true" ? true :
206
+ buf === "false" ? false :
207
+ !(values[tagName] as boolean);
208
+ await write(tagName as any, desired as any);
209
+ setBuf(tagName, "");
210
+ return;
211
+ }
212
+
213
+ if (tag.valueType === "number") {
214
+ if (buf == null || buf.trim() === "") {
215
+ setErr(tagName, "Enter a number.");
216
+ return;
217
+ }
218
+ const n = Number(buf);
219
+ if (Number.isNaN(n)) {
220
+ setErr(tagName, "Invalid number.");
221
+ return;
222
+ }
223
+ await write(tagName as any, n as any);
224
+ setBuf(tagName, "");
225
+ return;
226
+ }
227
+
228
+ if (tag.valueType === "string") {
229
+ await write(tagName as any, (buf ?? "") as any);
230
+ setBuf(tagName, "");
231
+ return;
232
+ }
233
+
234
+ // json
235
+ try {
236
+ const parsed = buf?.trim() ? JSON.parse(buf) : null;
237
+ await write(tagName as any, parsed as any);
238
+ setBuf(tagName, "");
239
+ } catch (e: any) {
240
+ setErr(tagName, "Invalid JSON.");
241
+ }
242
+ } catch (e: any) {
243
+ setErr(tagName, e?.message ?? String(e));
244
+ }
245
+ }, [editBuf, setBuf, setErr, write, values]);
246
+
247
+ const onKeyDownCommit = (ev: React.KeyboardEvent, tag: TagConfig) => {
248
+ if (ev.key === "Enter" && !ev.shiftKey) {
249
+ ev.preventDefault();
250
+ void commit(tag);
251
+ }
252
+ };
253
+
254
+ return (
255
+ <div className={`rounded-md border border-gray-200 bg-white text-sm ${className}`} style={{ minWidth: 680 }}>
256
+ <div className="flex items-center justify-between px-3 py-2" style={{ borderBottom: "1px solid #eee" }}>
257
+ <div className="flex items-center gap-2">
258
+ <strong>{title}</strong>
259
+ <span
260
+ title={isLoading ? "Loading" : "Live"}
261
+ style={{
262
+ width: 8, height: 8, borderRadius: 999,
263
+ background: isLoading ? "#aaa" : "#22c55e",
264
+ display: "inline-block"
265
+ }}
266
+ />
267
+ </div>
268
+ </div>
269
+
270
+ <div style={{ overflowX: "auto" }}>
271
+ <table style={{ borderCollapse: "collapse", width: "100%" }}>
272
+ <thead>
273
+ <tr>
274
+ <Th>Tag</Th>
275
+ <Th>Kind</Th>
276
+ <Th>Domain</Th>
277
+ <Th>Symbol</Th>
278
+ <Th>Display</Th>
279
+ <Th>Raw</Th>
280
+ <Th>Scale</Th>
281
+ <Th>Units</Th>
282
+ <Th>Input</Th>
283
+ <Th>Actions</Th>
284
+ </tr>
285
+ </thead>
286
+ <tbody>
287
+ {rows.map(({ tag, display, raw, scaleName, factor, label }) => {
288
+ const buf = editBuf[tag.fqdn] ?? "";
289
+ const err = errors[tag.fqdn];
290
+
291
+ return (
292
+ <tr key={tag.fqdn}>
293
+ <Td mono>{tag.tagName}</Td>
294
+ <Td mono>{tag.valueType}</Td>
295
+ <Td mono>{getDomain(tag.fqdn)}</Td>
296
+ <Td mono>{tag.fqdn}</Td>
297
+ <Td mono>{fmt(display)}</Td>
298
+ <Td mono>{fmt(raw)}</Td>
299
+ <Td mono>{scaleName ? `${scaleName} ×${factor ?? 1}` : "—"}</Td>
300
+ <Td mono>{scaleName ? (label ?? "") : "—"}</Td>
301
+ <Td>
302
+ <InputForTag
303
+ tag={tag}
304
+ buf={buf}
305
+ setBuf={(v) => setBuf(tag.fqdn, v)}
306
+ onKeyDown={(e) => onKeyDownCommit(e, tag)}
307
+ />
308
+ {err && <div style={{ color: "#dc2626", marginTop: 4 }}>{err}</div>}
309
+ </Td>
310
+ <Td>
311
+ <div style={{ display: "flex", gap: 6 }}>
312
+ <button onClick={() => commit(tag)}>Write</button>
313
+ {tag.valueType === "boolean" && (
314
+ <button onClick={() => tap(tag.fqdn as any)}>TAP</button>
315
+ )}
316
+ </div>
317
+ </Td>
318
+ </tr>
319
+ );
320
+ })}
321
+ </tbody>
322
+ </table>
323
+ </div>
324
+ </div>
325
+ );
326
+ };
327
+
328
+ /** ---------- helpers ---------- */
329
+
330
+ const Th: React.FC<React.PropsWithChildren<{}>> = ({ children }) => (
331
+ <th style={{
332
+ textAlign: "left",
333
+ borderBottom: "1px solid #ddd",
334
+ padding: "6px 8px",
335
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace"
336
+ }}>{children}</th>
337
+ );
338
+
339
+ const Td: React.FC<React.PropsWithChildren<{ mono?: boolean }>> = ({ children, mono }) => (
340
+ <td style={{
341
+ borderBottom: "1px solid #eee",
342
+ padding: "6px 8px",
343
+ whiteSpace: "nowrap",
344
+ fontFamily: mono ? "ui-monospace, SFMono-Regular, Menlo, monospace" : "inherit"
345
+ }}>{children}</td>
346
+ );
347
+
348
+ const InputForTag: React.FC<{
349
+ tag: TagConfig;
350
+ buf: string;
351
+ setBuf: (v: string) => void;
352
+ onKeyDown: (e: React.KeyboardEvent) => void;
353
+ }> = ({ tag, buf, setBuf, onKeyDown }) => {
354
+ if (tag.valueType === "boolean") {
355
+ // Boolean: checkbox controls direct true/false (buffer mirrors state as string)
356
+ return (
357
+ <label style={{ display: "inline-flex", alignItems: "center", gap: 6 }}>
358
+ <input
359
+ type="checkbox"
360
+ checked={buf ? buf === "true" : (Boolean as any)}
361
+ onChange={(e) => setBuf(e.target.checked ? "true" : "false")}
362
+ onKeyDown={onKeyDown}
363
+ />
364
+ <span>set</span>
365
+ </label>
366
+ );
367
+ }
368
+
369
+ if (tag.valueType === "number") {
370
+ return (
371
+ <input
372
+ type="number"
373
+ step="any"
374
+ value={buf}
375
+ onChange={(e) => setBuf(e.target.value)}
376
+ onKeyDown={onKeyDown}
377
+ style={{ width: 140 }}
378
+ placeholder="number…"
379
+ />
380
+ );
381
+ }
382
+
383
+ if (tag.valueType === "string") {
384
+ return (
385
+ <input
386
+ type="text"
387
+ value={buf}
388
+ onChange={(e) => setBuf(e.target.value)}
389
+ onKeyDown={onKeyDown}
390
+ style={{ width: 180 }}
391
+ placeholder="text…"
392
+ />
393
+ );
394
+ }
395
+
396
+ // json
397
+ return (
398
+ <textarea
399
+ value={buf}
400
+ onChange={(e) => setBuf(e.target.value)}
401
+ onKeyDown={onKeyDown}
402
+ rows={2}
403
+ style={{ width: 260, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace" }}
404
+ placeholder='{"foo": 42}'
405
+ />
406
+ );
407
+ };
408
+
409
+ function fmt(v: unknown) {
410
+ if (v === null || v === undefined) return "—";
411
+ if (typeof v === "number") return Number.isFinite(v) ? v.toString() : String(v);
412
+ if (typeof v === "string") return v;
413
+ try { return JSON.stringify(v); } catch { return String(v); }
414
+ }
@@ -2,7 +2,7 @@
2
2
  * Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
3
3
  * Created Date: 2024-03-17 08:43:02
4
4
  * -----
5
- * Last Modified: 2024-03-18 11:29:08
5
+ * Last Modified: 2025-09-05 14:52:18
6
6
  * -----
7
7
  *
8
8
  */
@@ -12,7 +12,7 @@
12
12
  import * as React from 'react';
13
13
  import { editor } from 'monaco-editor';
14
14
  //import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
15
- import Editor, { Monaco } from '@monaco-editor/react';
15
+ import Editor, { type Monaco } from '@monaco-editor/react';
16
16
 
17
17
 
18
18
  interface CodeEditorProps {
@@ -2,7 +2,7 @@
2
2
  * Copyright (C) 2024 Automated Design Corp.. All Rights Reserved.
3
3
  * Created Date: 2024-04-24 16:01:53
4
4
  * -----
5
- * Last Modified: 2025-01-20 19:15:50
5
+ * Last Modified: 2025-09-05 14:53:22
6
6
  * -----
7
7
  *
8
8
  */
@@ -21,9 +21,10 @@ import { Column } from 'primereact/column';
21
21
  import { Toolbar } from 'primereact/toolbar';
22
22
  import { Button } from 'primereact/button';
23
23
  import { confirmPopup } from 'primereact/confirmpopup';
24
- import { FileUpload, FileUploadHandlerEvent} from 'primereact/fileupload';
24
+ import { FileUpload, type FileUploadHandlerEvent} from 'primereact/fileupload';
25
25
 
26
26
  import { EventEmitterContext } from '../core/EventEmitterContext';
27
+ import { MessageType } from '../hub/CommandMessage';
27
28
 
28
29
 
29
30
  /**
@@ -148,7 +149,7 @@ export const FileList: React.FC<FileListProps> = ({
148
149
  const listFiles = async () => {
149
150
  try {
150
151
  const args = subdir !== undefined ? { "subdir": subdir } : {};
151
- let res = await invoke(domain, "list_files", args);
152
+ let res = await invoke(`${domain}.list_files`, MessageType.Request, args);
152
153
 
153
154
  let items = [];
154
155
  for (let i = 0; i < res.data.length; ++i) {
@@ -179,7 +180,7 @@ export const FileList: React.FC<FileListProps> = ({
179
180
  let target = makeTargetName(file.name);
180
181
 
181
182
  try {
182
- await invoke(domain, "download_file", { file_name: target });
183
+ await invoke(`${domain}.download_file`, MessageType.Request, { file_name: target });
183
184
  if (onSuccess)
184
185
  onSuccess(`Downloaded file: ${file.name}`);
185
186
  } catch (error) {
@@ -199,7 +200,7 @@ export const FileList: React.FC<FileListProps> = ({
199
200
  let target = makeTargetName(file_name);
200
201
 
201
202
  try {
202
- await invoke(domain, "delete_file", { file_name: target });
203
+ await invoke(`${domain}.delete_file`, MessageType.Request, { file_name: target });
203
204
  if (onSuccess)
204
205
  onSuccess(`Deleted file: ${file_name}`);
205
206
 
@@ -253,7 +254,7 @@ export const FileList: React.FC<FileListProps> = ({
253
254
  const base64String = arrayBufferToBase64(arrayBuffer);
254
255
 
255
256
  try {
256
- await invoke(domain, "write_file", { file_name: target, value: base64String, options :{"base64" : true} });
257
+ await invoke(`${domain}.write_file`, MessageType.Request, { file_name: target, value: base64String, options: { "base64": true } });
257
258
 
258
259
  if (onSuccess)
259
260
  onSuccess(`Uploaded file ${file.name}`);
@@ -14,6 +14,7 @@ import { Column } from 'primereact/column';
14
14
  import { Button } from 'primereact/button';
15
15
 
16
16
  import { EventEmitterContext } from "../core/EventEmitterContext";
17
+ import { MessageType } from '../hub/CommandMessage';
17
18
 
18
19
  type FileSelectProps = {
19
20
  domain?: string,
@@ -54,7 +55,7 @@ export const FileSelect: React.FC<FileSelectProps> = ({
54
55
  args = subdir ? { "subdir": subdir } : {};
55
56
  }
56
57
 
57
- const res = await invoke(domain, "list_files", args);
58
+ const res = await invoke(`${domain}.list_files`, MessageType.Request, args);
58
59
  const items = res.data.map((item: string, index: number) => ({
59
60
  id: index + 1,
60
61
  name: item
@@ -2,7 +2,7 @@
2
2
  * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
3
  * Created Date: 2024-01-16 14:39:41
4
4
  * -----
5
- * Last Modified: 2024-03-12 21:53:48
5
+ * Last Modified: 2025-09-05 14:52:12
6
6
  * -----
7
7
  *
8
8
  */
@@ -10,7 +10,7 @@
10
10
 
11
11
  import React, { Component } from 'react';
12
12
  //import clsx from 'clsx';
13
- import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
13
+ import { EventEmitterContext, type EventEmitterContextType } from '../core/EventEmitterContext';
14
14
  //import { IPositionContext } from '../core/PositionContext';
15
15
  import {IndicatorColor} from "../core/IndicatorColor";
16
16
  export {IndicatorColor}
@@ -1,8 +1,8 @@
1
1
  import React, { useCallback, useContext, useEffect, useState } from "react";
2
- import { Button, ButtonProps } from "primereact/button";
2
+ import { Button, type ButtonProps } from "primereact/button";
3
3
  import {
4
4
  EventEmitterContext,
5
- EventEmitterContextType,
5
+ type EventEmitterContextType,
6
6
  } from "../core/EventEmitterContext";
7
7
  import { IndicatorColor } from "../core/IndicatorColor";
8
8
  export { IndicatorColor };
@@ -2,13 +2,13 @@
2
2
  * Copyright (C) 2025 Automated Design Corp.. All Rights Reserved.
3
3
  * Created Date: 2025-01-20 15:09:55
4
4
  * -----
5
- * Last Modified: 2025-01-20 15:10:06
5
+ * Last Modified: 2025-09-05 14:51:58
6
6
  * -----
7
7
  *
8
8
  */
9
9
 
10
10
  import { Component } from 'react';
11
- import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
11
+ import { EventEmitterContext, type EventEmitterContextType } from '../core/EventEmitterContext';
12
12
  import { IndicatorColor } from "../core/IndicatorColor";
13
13
  export { IndicatorColor };
14
14
 
@@ -2,7 +2,7 @@
2
2
  * Copyright (C) 2024 Automated Design Corp. All Rights Reserved.
3
3
  * Created Date: 2024-01-16 14:39:41
4
4
  * -----
5
- * Last Modified: 2024-03-12 21:12:29
5
+ * Last Modified: 2025-09-05 14:51:51
6
6
  * -----
7
7
  *
8
8
  */
@@ -73,8 +73,8 @@
73
73
 
74
74
  import React, { Component } from 'react';
75
75
  import clsx from 'clsx';
76
- import { EventEmitterContext, EventEmitterContextType } from '../core/EventEmitterContext';
77
- import { IPositionContext } from '../core/PositionContext';
76
+ import { EventEmitterContext, type EventEmitterContextType } from '../core/EventEmitterContext';
77
+ import type { IPositionContext } from '../core/PositionContext';
78
78
  import {IndicatorColor} from "../core/IndicatorColor";
79
79
  export {IndicatorColor}
80
80