@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
@@ -1,35 +1,52 @@
1
- /** @file
1
+ /**
2
+ * @module hub/HubWebSocket
2
3
  *
3
- * ## broadcast messages
4
- * The result field of CommandMessages used for broadcast must have
5
- * success set to true, and must contain the field "topic." The topic field, along
6
- * with the domain field of the CommandMessage will be combined for the topic used
7
- * by the websocket client.
4
+ * Implementation of `HubBase` using standard WebSockets.
8
5
  *
9
- * broadcast topic = `${CommandMessage.domain}/${CommandMessage.result["topic"]}
6
+ * ## Functionality
10
7
  *
11
- * So, to subscribe to a broadcast topic for GM.fReal that is served by the ADS client, the
12
- * topic will be: "ADS/GM.fReal"
8
+ * - **Transport**: Connects to `ws://host:port/ws/` (or `wss://`).
9
+ * - **Request/Response**: Correlates requests to responses using `transaction_id`.
10
+ * - **Broadcasts**: Handles unsolicited messages (subscriptions) and routes them via `HubBase.publish`.
11
+ * - **Binary Data**: Handles `FILE_DOWNLOAD` events by decoding Base64 payloads into Blobs.
12
+ *
13
+ * ## Protocol
14
+ *
15
+ * Messages are JSON-serialized `CommandMessage` objects.
16
+ * - **Requests**: Client sends `message_type` (Read/Write/etc) + `transaction_id`.
17
+ * - **Responses**: Server replies with same `transaction_id` + `success`/`data`.
18
+ * - **Broadcasts**: Server sends `message_type: Broadcast` + `topic` (FQDN) + `data`.
13
19
  */
14
20
  import { HubBase } from './HubBase';
15
- import { CommandMessage, CommandMessageResult } from "./CommandMessage";
21
+ import { MessageType, type CommandMessage } from "./CommandMessage";
22
+ /**
23
+ * WebSocket implementation of the Hub communication layer.
24
+ */
16
25
  export declare class HubWebSocket extends HubBase {
17
26
  private socket;
18
27
  private requestId;
28
+ /**
29
+ * Map of pending Transaction ID -> Promise Resolvers.
30
+ * Used to match asynchronous WebSocket responses to their original requests.
31
+ */
19
32
  private pendingRequests;
20
33
  /**
21
- * Constructor. Creates and attempts to make the Websocket connection.
34
+ * Initializes the WebSocket connection immediately.
22
35
  */
23
36
  constructor();
24
37
  /**
25
- * Invoke a command in the remote webserver.
26
- * @param domain The domain of the Servelet supplying the functionality.
27
- * @param fname The name of the command to execute.
28
- * @param payload The arguments of the command.
29
- * @returns Promise<CommandMessageResult>
38
+ * Sends a command to the server via WebSocket.
39
+ *
40
+ * Wraps the operation in a Promise that resolves when the server replies
41
+ * with a matching `transaction_id`.
42
+ */
43
+ invoke: (topic: string, messageType: MessageType, payload?: object) => Promise<CommandMessage>;
44
+ /**
45
+ * Processes messages that are not responses to a specific request.
46
+ * Usually these are subscription updates (Broadcasts).
30
47
  */
31
- invoke: (domain: string, fname: string, payload?: object) => Promise<CommandMessageResult>;
32
48
  handleUnsolicitedMessage: (msg: CommandMessage) => void;
33
49
  disconnect: () => void;
34
50
  protected emit: (eventName: string, payload?: object) => void;
35
51
  }
52
+ //# sourceMappingURL=HubWebSocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HubWebSocket.d.ts","sourceRoot":"","sources":["../../src/hub/HubWebSocket.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+DpE;;GAEG;AACH,qBAAa,YAAa,SAAQ,OAAO;IACrC,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,SAAS,CAAK;IAEtB;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAoC;IAE3D;;OAEG;;IA4FH;;;;;OAKG;IACH,MAAM,GAAI,OAAO,MAAM,EAAE,aAAa,WAAW,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,cAAc,CAAC,CAqB5F;IAED;;;OAGG;IACH,wBAAwB,GAAI,KAAK,cAAc,UAO9C;IAED,UAAU,QAAO,IAAI,CAEpB;IAED,SAAS,CAAC,IAAI,GAAI,WAAW,MAAM,EAAE,UAAU,MAAM,KAAG,IAAI,CAE3D;CACJ"}
@@ -1 +1 @@
1
- import{HubBase}from"./HubBase";function b64toBlob(e,t="application/octet-stream",s=512){const n=atob(e),o=[];for(let e=0;e<n.length;e+=s){const t=n.slice(e,e+s),r=new Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);const i=new Uint8Array(r);o.push(i)}return new Blob(o,{type:t})}function downloadBlob(e,t){const s=window.URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(s)}export class HubWebSocket extends HubBase{constructor(){super(),Object.defineProperty(this,"socket",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pendingRequests",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"invoke",{enumerable:!0,configurable:!0,writable:!0,value:(e,t,s)=>new Promise(((n,o)=>{const r=++this.requestId;this.pendingRequests.set(r,{resolve:n,reject:o});let i={request_id:r,domain:e,fname:t,args:s,result:void 0};this.socket.send(JSON.stringify(i))}))}),Object.defineProperty(this,"handleUnsolicitedMessage",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if("BROADCAST"===e.fname&&e.domain.length>=1&&void 0!==e.result&&null!==e.result&&void 0!==e.result.data&&null!==e.result.data){let t=`${e.domain}/${e.result.data.topic}`;this.publish(t,e.result.data)}}}),Object.defineProperty(this,"disconnect",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.socket.close()}}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.socket.send(JSON.stringify({eventName:e,payload:t}))}});const e=window.location.hostname;let t;const s=`${"https:"===window.location.protocol?"wss://":"ws://"}${e}${t?":"+t:""}/ws/`;this.socket=new WebSocket(s);let n=this;this.socket.onopen=function(){n.publish("HUB/connected",!0),n.setIsConnected(!0)},this.socket.onmessage=e=>{const t=JSON.parse(e.data);if(t.request_id&&this.pendingRequests.has(t.request_id)){const{resolve:e,reject:s}=this.pendingRequests.get(t.request_id);if("FILE_DOWNLOAD"===t.fname&&void 0!==t.args.file_name&&null!==t.args.file_name&&t.args.file_name.length>0){let n=t.args.file_name.split("/");const o=n[n.length-1];if(t.result&&t.result.success){downloadBlob(b64toBlob(t.result.data),o),t.result.data=o,e(t.result)}else s(new Error(t.result?.error_message))}else t.result?.success?e(t.result):s(new Error(t.result?.error_message));this.pendingRequests.delete(t.request_id)}else this.handleUnsolicitedMessage(t)},this.socket.onerror=e=>{},this.socket.onclose=()=>{n.setIsConnected(!1)}}}
1
+ import{HubBase}from"./HubBase";import{MessageType}from"./CommandMessage";import{getDebugPanel}from"./DebugPanel";function b64toBlob(e,t="application/octet-stream",s=512){const n=atob(e),o=[];for(let e=0;e<n.length;e+=s){const t=n.slice(e,e+s),a=new Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);const i=new Uint8Array(a);o.push(i.buffer)}return new Blob(o,{type:t})}function downloadBlob(e,t){const s=window.URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(s)}export class HubWebSocket extends HubBase{constructor(){super(),Object.defineProperty(this,"socket",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"requestId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pendingRequests",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"invoke",{enumerable:!0,configurable:!0,writable:!0,value:(e,t,s)=>new Promise((n,o)=>{const a=++this.requestId;this.pendingRequests.set(a,{resolve:n,reject:o});const i={transaction_id:a,topic:e,data:s||{},timecode:Date.now(),message_type:t,success:!1,error_message:""};getDebugPanel().messageSent(MessageType[t],e,a),this.socket.send(JSON.stringify(i))})}),Object.defineProperty(this,"handleUnsolicitedMessage",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.message_type==MessageType.Broadcast&&e.topic.length>1&&this.publish(e.topic,e.data)}}),Object.defineProperty(this,"disconnect",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.socket.close()}}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.socket.send(JSON.stringify({eventName:e,payload:t}))}}),getDebugPanel().hubCreated();const e=window.location.hostname,t=window.location.port,s=`${"https:"===window.location.protocol?"wss://":"ws://"}${e}${t?":"+t:""}/ws/`;this.socket=new WebSocket(s);let n=this;this.socket.onopen=function(){getDebugPanel().wsOpened(s),n.publish("HUB/connected",!0),n.setIsConnected(!0)},this.socket.onmessage=e=>{const t=JSON.parse(e.data);if(getDebugPanel().messageReceived(MessageType[t.message_type]||String(t.message_type),t.topic,t.transaction_id),t.transaction_id&&this.pendingRequests.has(t.transaction_id)){const{resolve:e,reject:s}=this.pendingRequests.get(t.transaction_id);if("FILE_DOWNLOAD"===t.topic&&void 0!==t.data.file_name&&null!==t.data.file_name&&t.data.file_name.length>0){let n=t.data.file_name.split("/");const o=n[n.length-1];if(t.success){downloadBlob(b64toBlob(t.data),o),t.data=o,e(t)}else s(new Error(t.error_message))}else t.success?e(t):s(new Error(t.error_message));this.pendingRequests.delete(t.transaction_id)}else this.handleUnsolicitedMessage(t)},this.socket.onerror=e=>{getDebugPanel().wsError(String(e))},this.socket.onclose=e=>{n.setIsConnected(!1),getDebugPanel().wsClosed(e.code,e.reason||"No reason")}}}
@@ -0,0 +1,23 @@
1
+ export interface DebugLogEntry {
2
+ timestamp: number;
3
+ source: string;
4
+ level: "info" | "warn" | "error" | "send" | "recv";
5
+ message: string;
6
+ data?: unknown;
7
+ }
8
+ export declare const debug: {
9
+ /** Log an info message */
10
+ info(source: string, message: string, data?: unknown): void;
11
+ /** Log a warning message */
12
+ warn(source: string, message: string, data?: unknown): void;
13
+ /** Log an error message */
14
+ error(source: string, message: string, data?: unknown): void;
15
+ /** Log an outgoing message (to server) */
16
+ send(source: string, message: string, data?: unknown): void;
17
+ /** Log an incoming message (from server) */
18
+ recv(source: string, message: string, data?: unknown): void;
19
+ /** Check if debug is enabled */
20
+ isEnabled(): boolean;
21
+ };
22
+ export default debug;
23
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/hub/debug.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAwFD,eAAO,MAAM,KAAK;IAChB,0BAA0B;iBACb,MAAM,WAAW,MAAM,SAAS,OAAO,GAAG,IAAI;IAI3D,4BAA4B;iBACf,MAAM,WAAW,MAAM,SAAS,OAAO,GAAG,IAAI;IAI3D,2BAA2B;kBACb,MAAM,WAAW,MAAM,SAAS,OAAO,GAAG,IAAI;IAI5D,0CAA0C;iBAC7B,MAAM,WAAW,MAAM,SAAS,OAAO,GAAG,IAAI;IAI3D,4CAA4C;iBAC/B,MAAM,WAAW,MAAM,SAAS,OAAO,GAAG,IAAI;IAI3D,gCAAgC;iBACnB,OAAO;CAGrB,CAAC;AAqEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1 @@
1
+ const state={enabled:!0,logs:[],maxLogs:1e3};function formatTime(e){const t=new Date(e);return t.toTimeString().slice(0,8)+"."+String(t.getMilliseconds()).padStart(3,"0")}function formatEntry(e){return`[${formatTime(e.timestamp)}] [${e.source}] ${e.message}`}function addLog(e,t,o,s){const r={timestamp:Date.now(),source:e,level:t,message:o,data:s};if(state.logs.push(r),state.logs.length>state.maxLogs&&state.logs.shift(),state.enabled){formatEntry(r),getLogStyle(t);t}}function getLogStyle(e){switch(e){case"error":return"color: #ff4444; font-weight: bold;";case"warn":return"color: #ffaa00;";case"send":return"color: #44ff44;";case"recv":return"color: #4444ff;";default:return"color: #888888;"}}export const debug={info(e,t,o){addLog(e,"info",t,o)},warn(e,t,o){addLog(e,"warn",t,o)},error(e,t,o){addLog(e,"error",t,o)},send(e,t,o){addLog(e,"send",t,o)},recv(e,t,o){addLog(e,"recv",t,o)},isEnabled:()=>state.enabled};const consoleAPI={enable(){state.enabled=!0},disable(){state.enabled=!1},get logs(){return[...state.logs]},clear(){state.logs=[]},dump(){for(const e of state.logs){formatEntry(e);e.level}},filterBySource:e=>state.logs.filter(t=>t.source.includes(e)),filterByLevel:e=>state.logs.filter(t=>t.level===e),getMessages:()=>state.logs.filter(e=>"send"===e.level||"recv"===e.level)};"undefined"!=typeof window&&(window.__AUTOCORE_DEBUG__=consoleAPI);export default debug;
@@ -2,14 +2,30 @@ import { HubBase as Hub } from './HubBase';
2
2
  import { HubTauri } from './HubTauri';
3
3
  import { HubWebSocket } from "./HubWebSocket";
4
4
  import { HubSimulate } from "./HubSimulate";
5
- import { CommandMessage, CommandMessageResult } from './CommandMessage';
6
5
  /**
7
- * Creates a connection to the backend.
8
- * @returns Hub
6
+ * Creates or returns the singleton Hub connection to the backend.
7
+ *
8
+ * The hub type is determined automatically:
9
+ * - If running in Tauri: HubTauri (direct Rust IPC)
10
+ * - Otherwise: HubWebSocket (WebSocket to autocore-server)
11
+ *
12
+ * @returns Hub The singleton hub instance
9
13
  */
10
14
  export declare function createHub(): Hub;
15
+ /**
16
+ * Returns the current hub instance, or null if not yet created.
17
+ * Useful for checking if a hub exists without creating one.
18
+ */
19
+ export declare function getHubInstance(): Hub | null;
20
+ /**
21
+ * Resets the singleton hub instance.
22
+ * This should only be used for testing or when intentionally reconnecting.
23
+ */
24
+ export declare function resetHub(): void;
11
25
  export { HubBase as Hub } from './HubBase';
12
26
  export { HubTauri };
13
27
  export { HubWebSocket };
14
28
  export { HubSimulate };
15
- export type { CommandMessage, CommandMessageResult };
29
+ export type { CommandMessage } from './CommandMessage';
30
+ export { MessageType } from './CommandMessage';
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hub/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAW5C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,GAAG,CAiB/B;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,GAAG,GAAG,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,IAAI,CAE/B;AAGD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,CAAC;AAGvB,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/hub/index.js CHANGED
@@ -1 +1 @@
1
- import{HubTauri}from"./HubTauri";import{HubWebSocket}from"./HubWebSocket";import{HubSimulate}from"./HubSimulate";let hubInstance=null;export function createHub(){return hubInstance||(hubInstance=void 0!==window.__TAURI__&&null!==window.__TAURI__?new HubTauri:new HubWebSocket),hubInstance}export{HubBase as Hub}from"./HubBase";export{HubTauri};export{HubWebSocket};export{HubSimulate};
1
+ import{HubBase as Hub}from"./HubBase";import{HubTauri}from"./HubTauri";import{HubWebSocket}from"./HubWebSocket";import{HubSimulate}from"./HubSimulate";import{getDebugPanel}from"./DebugPanel";let hubInstance=null;export function createHub(){const e=getDebugPanel();return e.log("info","createHub",`called (hasInstance: ${!!hubInstance})`),hubInstance?e.log("info","createHub","Returning existing hub instance"):"undefined"!=typeof window&&void 0!==window.__TAURI__&&null!==window.__TAURI__?(e.log("info","createHub","Creating HubTauri instance"),hubInstance=new HubTauri):(e.log("info","createHub","Creating HubWebSocket instance"),hubInstance=new HubWebSocket),hubInstance}export function getHubInstance(){return hubInstance}export function resetHub(){hubInstance=null}export{HubBase as Hub}from"./HubBase";export{HubTauri};export{HubWebSocket};export{HubSimulate};export{MessageType}from"./CommandMessage";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adcops/autocore-react",
3
- "version": "3.0.40",
3
+ "version": "3.3.2",
4
4
  "description": "A React component library for industrial user interfaces.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -14,6 +14,7 @@
14
14
  "dev": "npm run clean && tsc && node ./tools/copy-distribution-files.cjs",
15
15
  "prestart": "tsc",
16
16
  "publish-package": "npm run build && npm version patch && npm publish",
17
+ "prepublishOnly": "npm run build",
17
18
  "release:patch": "npm version patch && npm publish",
18
19
  "release:minor": "npm version minor && npm publish",
19
20
  "release:major": "npm version major && npm publish",
@@ -26,8 +27,10 @@
26
27
  "keywords": [
27
28
  "react",
28
29
  "autocore",
29
- "component",
30
- "dispatcher"
30
+ "component-library",
31
+ "industrial-ui",
32
+ "typescript",
33
+ "primereact"
31
34
  ],
32
35
  "author": "Automated Design Corp.",
33
36
  "license": "ISC",
@@ -36,10 +39,10 @@
36
39
  },
37
40
  "homepage": "https://automateddesign.com",
38
41
  "peerDependencies": {
39
- "@types/react": ">=18.0.0",
40
- "react": ">=18.2.0",
41
- "react-dom": ">=18.2.0",
42
- "primereact": ">=10.6.3"
42
+ "@types/react": "^18",
43
+ "primereact": ">=10.6.3",
44
+ "react": "^18",
45
+ "react-dom": "^18"
43
46
  },
44
47
  "peerDependenciesMeta": {
45
48
  "@types/react": {
@@ -47,49 +50,51 @@
47
50
  }
48
51
  },
49
52
  "dependencies": {
50
- "@monaco-editor/react": "^4.6.0",
51
- "@tauri-apps/api": "^1.5.3",
52
- "@types/react-dom": "^18.2.18",
53
- "@types/react-transition-group": "^4.4.1",
54
- "clsx": "^2.1.0",
53
+ "@monaco-editor/react": "^4.7.0",
54
+ "@tauri-apps/api": "^2.9.1",
55
+ "clsx": "^2.1.1",
55
56
  "numerable": "^0.3.15",
56
- "react-blockly": "^8.1.1",
57
- "react-simple-keyboard": "^3.7.65",
58
- "react-transition-group": "^4.4.1",
59
- "sass": "^1.89.2",
60
- "socket.io-client": "^4.7.2",
57
+ "react-blockly": "^8.1.2",
58
+ "react-simple-keyboard": "^3.8.120",
59
+ "react-transition-group": "^4.4.5",
60
+ "sass": "^1.92.1",
61
+ "socket.io-client": "^4.8.1",
61
62
  "use-fit-text": "^2.4.0"
62
63
  },
63
64
  "sideEffects": [
64
- "**/*.css"
65
+ "**/*.css",
66
+ "**/*.scss"
65
67
  ],
66
68
  "engines": {
67
69
  "node": ">=20.0.0"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@svgr/cli": "^8.1.0",
71
- "rimraf": "^5.0.5",
72
- "terser": "^5.26.0",
73
- "typedoc": "^0.25.11",
74
- "typescript": "^5.0.2",
75
- "primereact": ">=10.6.3"
73
+ "@types/react": "^18.2.15",
74
+ "@types/react-dom": "^18.2.7",
75
+ "@types/react-transition-group": "^4.4.12",
76
+ "primereact": "^10.9.7",
77
+ "rimraf": "^6.0.1",
78
+ "terser": "^5.44.0",
79
+ "typedoc": "^0.28.12",
80
+ "typescript": "^5.9.2"
76
81
  },
77
82
  "exports": {
78
83
  "./core/*": {
79
84
  "import": "./dist/core/*",
80
- "types": "./dist/core/*.d.js"
85
+ "types": "./dist/core/*.d.ts"
81
86
  },
82
87
  "./components/*": {
83
88
  "import": "./dist/components/*",
84
- "types": "./dist/components/*.d.js"
89
+ "types": "./dist/components/*.d.ts"
85
90
  },
86
91
  "./hooks/*": {
87
92
  "import": "./dist/hooks/*",
88
- "types": "./dist/hooks/*.d.js"
93
+ "types": "./dist/hooks/*.d.ts"
89
94
  },
90
95
  "./themes/*": {
91
96
  "import": "./dist/themes/*",
92
- "types": "./dist/themes/*.d.js"
97
+ "types": "./dist/themes/*.d.ts"
93
98
  }
94
99
  }
95
100
  }
package/readme.md CHANGED
@@ -15,26 +15,202 @@ PrimeReact to supply almost all but the most obscure controls, and adds a wrappe
15
15
  signals from the backend to the common controls. This allows autocore-react to focus on the additional
16
16
  features needed for machine-control user interfaces, while PrimeReact excels at development of components.
17
17
 
18
- ## Hub
18
+ ## Installation
19
19
 
20
- Whether running in a browser or within a Tauri application, the user interface of a web app needs to
21
- communicate with a backed. The Hub abstracts this by defining a common base class, then automatically
22
- selecting the proper pipeline based upon the environment. If the Tauri environment is detected, HubTauri
23
- is loaded. For a browser instance, a socket.io connection is used. When running in a development environment,
24
- a simulated backend that simply echoes responses is used.
20
+ Install from NPM.
25
21
 
26
- When writing the main application or developing components, you only need to focus on the Hub class. Because the
27
- backend is selected automatically, the web application does not need to be modified for each individual environment.
22
+ ```
23
+ npm install --save @adcops/autocore-react
24
+ ```
28
25
 
26
+ ## Quick Start
29
27
 
30
- ## Installation
28
+ ### 1. Define Your Tags
31
29
 
32
- Install from NPM.
30
+ Create `AutoCoreTags.ts` to define all the tags your application will use:
33
31
 
32
+ ```typescript
33
+ import type { TagConfig } from "@adcops/autocore-react/core/AutoCoreTagTypes";
34
+
35
+ export const acTagSpec = [
36
+ { "tagName": "isControlPowerOk", "domain": "ADS", "symbolName": "GIO.xbControlPowerOk", "valueType": "boolean" },
37
+ { "tagName": "motorSpeed", "domain": "ADS", "symbolName": "MAIN.ctx.motor.fSpeed", "valueType": "number" },
38
+ { "tagName": "isAutoCycleRunning", "domain": "ADS", "symbolName": "MAIN.ctx.gm.bAutoCycleRunning", "valueType": "boolean" },
39
+ { "tagName": "positionScalar", "domain": "MEMORYSTORE", "symbolName": "position_scalar", "valueType": "number", "initialValue": 1.0 }
40
+ ] as const satisfies readonly TagConfig[];
41
+
42
+ export default acTagSpec;
34
43
  ```
35
- npm install --save @adcops/autocore-react
44
+
45
+ ### 2. Create Typed Hooks
46
+
47
+ Create `AutoCore.ts` to generate strongly-typed hooks:
48
+
49
+ ```typescript
50
+ import { acTagSpec } from "./AutoCoreTags";
51
+ import { AutoCoreTagContext } from "@adcops/autocore-react/core/AutoCoreTagContext";
52
+ import { makeAutoCoreTagHooks } from "@adcops/autocore-react/hooks/useAutoCoreTag";
53
+
54
+ export const AutoCoreHooks = makeAutoCoreTagHooks(AutoCoreTagContext, acTagSpec);
55
+ ```
56
+
57
+
58
+ #### Define Scales (Optional)
59
+ For applications that need unit conversion, create `AutoCoreScales.ts` with server-driven scaling:
60
+
61
+
62
+ ```tsx
63
+ import { ScaleConfig } from "@adcops/autocore-react/core/AutoCoreTagTypes";
64
+
65
+ export const acScales = {
66
+ position: {
67
+ name: "position",
68
+ scale: 1.0,
69
+ label: "mm",
70
+ serverTag: { domain: "GNV", symbolName: "position_scalar" }
71
+ },
72
+ load: {
73
+ name: "load",
74
+ scale: 1.0,
75
+ label: "N",
76
+ serverTag: { domain: "GNV", symbolName: "load_scalar" }
77
+ }
78
+ } as const satisfies Record<string, ScaleConfig>;
79
+ ```
80
+
81
+ Note: Server tags now store both scale factor and label as a JSON object: `{ scale: 1.0, label: "mm" }`. Legacy numeric-only values are supported for backward compatibility.
82
+
83
+ Next, reference scales in your tag definitions.
84
+
85
+ ```tsx
86
+ // In AutoCoreTags.ts - add scale property to numeric tags
87
+ { "tagName": "pressPosition", "domain": "ADS", "symbolName": "MAIN.ctx.gm.fPressPosition", "valueType": "number", "scale": "position" },
88
+ { "tagName": "pressLoad", "domain": "ADS", "symbolName": "MAIN.ctx.gm.fPressLoad", "valueType": "number", "scale": "load" }
89
+ ```
90
+
91
+ ### 3. Wrap Your App
92
+
93
+ Update your `App.tsx` to provide the contexts:
94
+
95
+ ```typescript
96
+ import React from 'react';
97
+ import { PrimeReactProvider } from 'primereact/api';
98
+ import { EventEmitterProvider } from "@adcops/autocore-react/core/EventEmitterContext";
99
+ import { AutoCoreTagProvider } from "@adcops/autocore-react/core/AutoCoreTagContext";
100
+ import { acTagSpec } from "./AutoCoreTags";
101
+ import { acScales } from "./AutoCoreScales";
102
+
103
+ function App() {
104
+ return (
105
+ <EventEmitterProvider>
106
+ <PrimeReactProvider>
107
+ <AutoCoreTagProvider tags={acTagSpec} scales={acScales} eagerRead>
108
+ <div className="app-wrapper">
109
+ <main className="main-wrapper">
110
+ <YourMainContent />
111
+ </main>
112
+ </div>
113
+ </AutoCoreTagProvider>
114
+ </PrimeReactProvider>
115
+ </EventEmitterProvider>
116
+ );
117
+ }
118
+
119
+ export default App;
36
120
  ```
37
121
 
122
+ ### 4. Use Tags in Components
123
+
124
+ Import your typed hooks and use them in any component:
125
+
126
+ ```typescript
127
+ import React from 'react';
128
+ import { Button } from 'primereact/button';
129
+ import { AutoCoreHooks } from './AutoCore';
130
+
131
+ export const ControlPanel: React.FC = () => {
132
+ // Single tag access
133
+ const { value: powerOk, write: setPowerOk } = AutoCoreHooks.useAutoCoreTag("isControlPowerOk");
134
+ const { value: motorSpeed, write: setMotorSpeed } = AutoCoreHooks.useAutoCoreTag("motorSpeed");
135
+
136
+ // Multiple tag access
137
+ const { values } = AutoCoreHooks.useAutoCoreTags(["isControlPowerOk", "isAutoCycleRunning"]);
138
+
139
+ // Computed state
140
+ const { selected: canStart } = AutoCoreHooks.useAutoCoreSelect(v =>
141
+ !!v["isControlPowerOk"] && !v["isAutoCycleRunning"]
142
+ );
143
+
144
+ return (
145
+ <div>
146
+ <div>Power OK: {powerOk ? "Yes" : "No"}</div>
147
+ <div>Motor Speed: {motorSpeed} RPM</div>
148
+
149
+ <Button
150
+ label="Start Motor"
151
+ disabled={!canStart}
152
+ onClick={() => setMotorSpeed(1000)}
153
+ />
154
+
155
+ <Button
156
+ label="Emergency Stop"
157
+ severity="danger"
158
+ onClick={() => setPowerOk(false)}
159
+ />
160
+ </div>
161
+ );
162
+ };
163
+ ```
164
+
165
+ ### 5. Development Panel (Optional)
166
+
167
+ Add a debugging panel for development:
168
+
169
+ ```typescript
170
+ import { AutoCoreDevPanel } from "@adcops/autocore-react/components/AutoCoreDevPanel";
171
+ import { acTagSpec } from "./AutoCoreTags";
172
+
173
+ // In your App component:
174
+ {process.env.NODE_ENV === 'development' && (
175
+ <AutoCoreDevPanel
176
+ tags={acTagSpec}
177
+ className="fixed bottom-4 right-4 bg-white shadow-lg"
178
+ />
179
+ )}
180
+ ```
181
+
182
+ ## AutoCoreTagContext Features
183
+
184
+ - **Strongly-typed**: Full TypeScript support with IntelliSense for tag names and value types
185
+ - **Global state**: Share tag values across your entire application
186
+ - **Real-time updates**: Automatic subscription to server data changes
187
+ - **No optimistic updates**: UI always reflects true server state
188
+ - **Error handling**: Proper async/await patterns with error feedback
189
+ - **Development tools**: Built-in debugging panel for testing
190
+
191
+ ## Architecture
192
+
193
+ ### Hub (Internal)
194
+
195
+ The Hub is an internal abstraction that handles communication with the backend. It automatically
196
+ selects the proper pipeline based on the environment: HubTauri for Tauri applications, socket.io
197
+ for browser instances, and a simulated backend for development environments.
198
+
199
+ **Important**: Applications should not interact with the Hub directly. Instead, use the higher-level
200
+ abstractions described below.
201
+
202
+ ### EventEmitterContext
203
+
204
+ The EventEmitterContext provides a global event system for component communication and backend
205
+ interaction through `invoke()`, `subscribe()`, and `dispatch()` methods. This is automatically
206
+ available when you wrap your app with `<EventEmitterProvider>`.
207
+
208
+ ### AutoCoreTagContext (Recommended)
209
+
210
+ For most backend data interactions, use the AutoCoreTagContext system with strongly-typed hooks.
211
+ This provides the cleanest, most maintainable approach for managing server state in your components.
212
+ See the Quick Start section above for setup and usage.
213
+
38
214
  ## Development
39
215
 
40
216
  We typically have an external Tauri project designed to import and test the autocore-react library. We find that
@@ -56,14 +232,12 @@ npm publish --tag staging --access=public
56
232
 
57
233
  Note that we have to specify that the access is public because the tag makes this "scoped," which are private by default.
58
234
 
59
-
60
235
  In the test project, simply install the 'staging' tag version.
61
236
 
62
237
  ```
63
238
  npm install @adcops/autocore-react@staging
64
239
  ```
65
240
 
66
-
67
241
  ### npm link
68
242
 
69
243
  In the root of the autocore-react project, initiate npm link:
@@ -131,10 +305,6 @@ overwrite existing .tsx files. If you need to update a pre-existing .tsx file, d
131
305
  Possible options for SVGR:
132
306
  https://react-svgr.com/docs/options/
133
307
 
134
-
135
-
136
-
137
-
138
308
  ## Documentation
139
309
 
140
310
  To generate documentation:
@@ -144,29 +314,30 @@ npm run generate-docs
144
314
 
145
315
  Publishing the package will also regenerate the documentation.
146
316
 
147
-
148
-
149
317
  ## Additional Documentation
150
318
 
151
319
  Beyond doc-comments in the code, we provide additional documentation in the additional-docs folder.
152
320
 
321
+ - AutoCoreTagContext Manual: [AutoCoreTagContext Manual](../additional-docs/AutoCoreTagContext.md).
153
322
  - Button API Specs: [Button API Specs](../additional-docs/ButtonApiSpecs.md).
154
323
  - Global Event Emitter: [Global Event Emitter](../additional-docs/GlobalEventEmitter.md).
155
324
 
156
-
157
325
  ## Acknowledgements
158
326
 
159
- Beyond the obvious, inherent React libraries, autocore-react greatly appreciates the works of
327
+ Beyond the obvious, inherent React and TypeScript libraries, autocore-react greatly appreciates the works of
160
328
  these additional libraries.
161
329
 
162
330
  - PrimeReact and PrimeIcons
163
331
  - numerable
164
332
  - Simple Keyboard (https://github.com/hodgef/simple-keyboard)
165
333
  - - We customize Simple Keyboard for cleaner physical keyboard integration.
334
+ - Monaco editor
335
+ - socket-io
336
+ - Tauri
166
337
 
167
338
  ## Copyright
168
339
 
169
- (C) Copyright 2021-2024 Automated Design Corp. All Rights Reserved.
340
+ (C) Copyright 2021-2025 Automated Design Corp. All Rights Reserved.
170
341
 
171
342
  ## License
172
343