@robotical/raftjs 1.3.3

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 (260) hide show
  1. package/.editorconfig +14 -0
  2. package/.gitattributes +11 -0
  3. package/.nvmrc +1 -0
  4. package/LICENSE +22 -0
  5. package/README.md +13 -0
  6. package/TODO.md +1 -0
  7. package/dist/react-native/RaftAttributeHandler.d.ts +12 -0
  8. package/dist/react-native/RaftAttributeHandler.js +241 -0
  9. package/dist/react-native/RaftAttributeHandler.js.map +1 -0
  10. package/dist/react-native/RaftChannel.d.ts +18 -0
  11. package/dist/react-native/RaftChannel.js +12 -0
  12. package/dist/react-native/RaftChannel.js.map +1 -0
  13. package/dist/react-native/RaftChannelBLE.native.d.ts +93 -0
  14. package/dist/react-native/RaftChannelBLE.native.js +455 -0
  15. package/dist/react-native/RaftChannelBLE.native.js.map +1 -0
  16. package/dist/react-native/RaftChannelBLE.web.d.ts +39 -0
  17. package/dist/react-native/RaftChannelBLE.web.js +294 -0
  18. package/dist/react-native/RaftChannelBLE.web.js.map +1 -0
  19. package/dist/react-native/RaftChannelBLEFactory.d.ts +10 -0
  20. package/dist/react-native/RaftChannelBLEFactory.js +17 -0
  21. package/dist/react-native/RaftChannelBLEFactory.js.map +1 -0
  22. package/dist/react-native/RaftChannelBLEScanner.native.d.ts +18 -0
  23. package/dist/react-native/RaftChannelBLEScanner.native.js +146 -0
  24. package/dist/react-native/RaftChannelBLEScanner.native.js.map +1 -0
  25. package/dist/react-native/RaftChannelWebSerial.d.ts +37 -0
  26. package/dist/react-native/RaftChannelWebSerial.js +320 -0
  27. package/dist/react-native/RaftChannelWebSerial.js.map +1 -0
  28. package/dist/react-native/RaftChannelWebSocket.d.ts +28 -0
  29. package/dist/react-native/RaftChannelWebSocket.js +197 -0
  30. package/dist/react-native/RaftChannelWebSocket.js.map +1 -0
  31. package/dist/react-native/RaftCommsStats.d.ts +39 -0
  32. package/dist/react-native/RaftCommsStats.js +128 -0
  33. package/dist/react-native/RaftCommsStats.js.map +1 -0
  34. package/dist/react-native/RaftConnEvents.d.ts +39 -0
  35. package/dist/react-native/RaftConnEvents.js +54 -0
  36. package/dist/react-native/RaftConnEvents.js.map +1 -0
  37. package/dist/react-native/RaftConnector.d.ts +245 -0
  38. package/dist/react-native/RaftConnector.js +614 -0
  39. package/dist/react-native/RaftConnector.js.map +1 -0
  40. package/dist/react-native/RaftCustomAttrHandler.d.ts +4 -0
  41. package/dist/react-native/RaftCustomAttrHandler.js +50 -0
  42. package/dist/react-native/RaftCustomAttrHandler.js.map +1 -0
  43. package/dist/react-native/RaftDeviceInfo.d.ts +59 -0
  44. package/dist/react-native/RaftDeviceInfo.js +36 -0
  45. package/dist/react-native/RaftDeviceInfo.js.map +1 -0
  46. package/dist/react-native/RaftDeviceManager.d.ts +35 -0
  47. package/dist/react-native/RaftDeviceManager.js +353 -0
  48. package/dist/react-native/RaftDeviceManager.js.map +1 -0
  49. package/dist/react-native/RaftDeviceMgrIF.d.ts +12 -0
  50. package/dist/react-native/RaftDeviceMgrIF.js +11 -0
  51. package/dist/react-native/RaftDeviceMgrIF.js.map +1 -0
  52. package/dist/react-native/RaftDeviceMsg.d.ts +9 -0
  53. package/dist/react-native/RaftDeviceMsg.js +11 -0
  54. package/dist/react-native/RaftDeviceMsg.js.map +1 -0
  55. package/dist/react-native/RaftDeviceStates.d.ts +33 -0
  56. package/dist/react-native/RaftDeviceStates.js +60 -0
  57. package/dist/react-native/RaftDeviceStates.js.map +1 -0
  58. package/dist/react-native/RaftFileHandler.d.ts +52 -0
  59. package/dist/react-native/RaftFileHandler.js +502 -0
  60. package/dist/react-native/RaftFileHandler.js.map +1 -0
  61. package/dist/react-native/RaftLog.d.ts +22 -0
  62. package/dist/react-native/RaftLog.js +63 -0
  63. package/dist/react-native/RaftLog.js.map +1 -0
  64. package/dist/react-native/RaftMiniHDLC.d.ts +18 -0
  65. package/dist/react-native/RaftMiniHDLC.js +383 -0
  66. package/dist/react-native/RaftMiniHDLC.js.map +1 -0
  67. package/dist/react-native/RaftMsgHandler.d.ts +57 -0
  68. package/dist/react-native/RaftMsgHandler.js +480 -0
  69. package/dist/react-native/RaftMsgHandler.js.map +1 -0
  70. package/dist/react-native/RaftMsgTrackInfo.d.ts +17 -0
  71. package/dist/react-native/RaftMsgTrackInfo.js +42 -0
  72. package/dist/react-native/RaftMsgTrackInfo.js.map +1 -0
  73. package/dist/react-native/RaftProtocolDefs.d.ts +30 -0
  74. package/dist/react-native/RaftProtocolDefs.js +48 -0
  75. package/dist/react-native/RaftProtocolDefs.js.map +1 -0
  76. package/dist/react-native/RaftStreamHandler.d.ts +38 -0
  77. package/dist/react-native/RaftStreamHandler.js +257 -0
  78. package/dist/react-native/RaftStreamHandler.js.map +1 -0
  79. package/dist/react-native/RaftSystemType.d.ts +25 -0
  80. package/dist/react-native/RaftSystemType.js +3 -0
  81. package/dist/react-native/RaftSystemType.js.map +1 -0
  82. package/dist/react-native/RaftSystemUtils.d.ts +136 -0
  83. package/dist/react-native/RaftSystemUtils.js +410 -0
  84. package/dist/react-native/RaftSystemUtils.js.map +1 -0
  85. package/dist/react-native/RaftTypes.d.ts +195 -0
  86. package/dist/react-native/RaftTypes.js +190 -0
  87. package/dist/react-native/RaftTypes.js.map +1 -0
  88. package/dist/react-native/RaftUpdateEvents.d.ts +33 -0
  89. package/dist/react-native/RaftUpdateEvents.js +46 -0
  90. package/dist/react-native/RaftUpdateEvents.js.map +1 -0
  91. package/dist/react-native/RaftUpdateManager.d.ts +61 -0
  92. package/dist/react-native/RaftUpdateManager.js +618 -0
  93. package/dist/react-native/RaftUpdateManager.js.map +1 -0
  94. package/dist/react-native/RaftUtils.d.ts +125 -0
  95. package/dist/react-native/RaftUtils.js +454 -0
  96. package/dist/react-native/RaftUtils.js.map +1 -0
  97. package/dist/react-native/RaftWifiTypes.d.ts +23 -0
  98. package/dist/react-native/RaftWifiTypes.js +43 -0
  99. package/dist/react-native/RaftWifiTypes.js.map +1 -0
  100. package/dist/react-native/main.d.ts +22 -0
  101. package/dist/react-native/main.js +48 -0
  102. package/dist/react-native/main.js.map +1 -0
  103. package/dist/web/RaftAttributeHandler.d.ts +12 -0
  104. package/dist/web/RaftAttributeHandler.js +241 -0
  105. package/dist/web/RaftAttributeHandler.js.map +1 -0
  106. package/dist/web/RaftChannel.d.ts +18 -0
  107. package/dist/web/RaftChannel.js +12 -0
  108. package/dist/web/RaftChannel.js.map +1 -0
  109. package/dist/web/RaftChannelBLE.web.d.ts +39 -0
  110. package/dist/web/RaftChannelBLE.web.js +294 -0
  111. package/dist/web/RaftChannelBLE.web.js.map +1 -0
  112. package/dist/web/RaftChannelBLEFactory.d.ts +10 -0
  113. package/dist/web/RaftChannelBLEFactory.js +17 -0
  114. package/dist/web/RaftChannelBLEFactory.js.map +1 -0
  115. package/dist/web/RaftChannelWebSerial.d.ts +37 -0
  116. package/dist/web/RaftChannelWebSerial.js +320 -0
  117. package/dist/web/RaftChannelWebSerial.js.map +1 -0
  118. package/dist/web/RaftChannelWebSocket.d.ts +28 -0
  119. package/dist/web/RaftChannelWebSocket.js +197 -0
  120. package/dist/web/RaftChannelWebSocket.js.map +1 -0
  121. package/dist/web/RaftCommsStats.d.ts +39 -0
  122. package/dist/web/RaftCommsStats.js +128 -0
  123. package/dist/web/RaftCommsStats.js.map +1 -0
  124. package/dist/web/RaftConnEvents.d.ts +39 -0
  125. package/dist/web/RaftConnEvents.js +54 -0
  126. package/dist/web/RaftConnEvents.js.map +1 -0
  127. package/dist/web/RaftConnector.d.ts +245 -0
  128. package/dist/web/RaftConnector.js +614 -0
  129. package/dist/web/RaftConnector.js.map +1 -0
  130. package/dist/web/RaftCustomAttrHandler.d.ts +4 -0
  131. package/dist/web/RaftCustomAttrHandler.js +50 -0
  132. package/dist/web/RaftCustomAttrHandler.js.map +1 -0
  133. package/dist/web/RaftDeviceInfo.d.ts +59 -0
  134. package/dist/web/RaftDeviceInfo.js +36 -0
  135. package/dist/web/RaftDeviceInfo.js.map +1 -0
  136. package/dist/web/RaftDeviceManager.d.ts +35 -0
  137. package/dist/web/RaftDeviceManager.js +353 -0
  138. package/dist/web/RaftDeviceManager.js.map +1 -0
  139. package/dist/web/RaftDeviceMgrIF.d.ts +12 -0
  140. package/dist/web/RaftDeviceMgrIF.js +11 -0
  141. package/dist/web/RaftDeviceMgrIF.js.map +1 -0
  142. package/dist/web/RaftDeviceMsg.d.ts +9 -0
  143. package/dist/web/RaftDeviceMsg.js +11 -0
  144. package/dist/web/RaftDeviceMsg.js.map +1 -0
  145. package/dist/web/RaftDeviceStates.d.ts +33 -0
  146. package/dist/web/RaftDeviceStates.js +60 -0
  147. package/dist/web/RaftDeviceStates.js.map +1 -0
  148. package/dist/web/RaftFileHandler.d.ts +52 -0
  149. package/dist/web/RaftFileHandler.js +502 -0
  150. package/dist/web/RaftFileHandler.js.map +1 -0
  151. package/dist/web/RaftLog.d.ts +22 -0
  152. package/dist/web/RaftLog.js +63 -0
  153. package/dist/web/RaftLog.js.map +1 -0
  154. package/dist/web/RaftMiniHDLC.d.ts +18 -0
  155. package/dist/web/RaftMiniHDLC.js +383 -0
  156. package/dist/web/RaftMiniHDLC.js.map +1 -0
  157. package/dist/web/RaftMsgHandler.d.ts +57 -0
  158. package/dist/web/RaftMsgHandler.js +480 -0
  159. package/dist/web/RaftMsgHandler.js.map +1 -0
  160. package/dist/web/RaftMsgTrackInfo.d.ts +17 -0
  161. package/dist/web/RaftMsgTrackInfo.js +42 -0
  162. package/dist/web/RaftMsgTrackInfo.js.map +1 -0
  163. package/dist/web/RaftProtocolDefs.d.ts +30 -0
  164. package/dist/web/RaftProtocolDefs.js +48 -0
  165. package/dist/web/RaftProtocolDefs.js.map +1 -0
  166. package/dist/web/RaftStreamHandler.d.ts +38 -0
  167. package/dist/web/RaftStreamHandler.js +257 -0
  168. package/dist/web/RaftStreamHandler.js.map +1 -0
  169. package/dist/web/RaftSystemType.d.ts +25 -0
  170. package/dist/web/RaftSystemType.js +3 -0
  171. package/dist/web/RaftSystemType.js.map +1 -0
  172. package/dist/web/RaftSystemUtils.d.ts +136 -0
  173. package/dist/web/RaftSystemUtils.js +410 -0
  174. package/dist/web/RaftSystemUtils.js.map +1 -0
  175. package/dist/web/RaftTypes.d.ts +195 -0
  176. package/dist/web/RaftTypes.js +190 -0
  177. package/dist/web/RaftTypes.js.map +1 -0
  178. package/dist/web/RaftUpdateEvents.d.ts +33 -0
  179. package/dist/web/RaftUpdateEvents.js +46 -0
  180. package/dist/web/RaftUpdateEvents.js.map +1 -0
  181. package/dist/web/RaftUpdateManager.d.ts +61 -0
  182. package/dist/web/RaftUpdateManager.js +618 -0
  183. package/dist/web/RaftUpdateManager.js.map +1 -0
  184. package/dist/web/RaftUtils.d.ts +125 -0
  185. package/dist/web/RaftUtils.js +454 -0
  186. package/dist/web/RaftUtils.js.map +1 -0
  187. package/dist/web/RaftWifiTypes.d.ts +23 -0
  188. package/dist/web/RaftWifiTypes.js +43 -0
  189. package/dist/web/RaftWifiTypes.js.map +1 -0
  190. package/dist/web/main.d.ts +22 -0
  191. package/dist/web/main.js +48 -0
  192. package/dist/web/main.js.map +1 -0
  193. package/eslint.config.mjs +33 -0
  194. package/examples/dashboard/package.json +43 -0
  195. package/examples/dashboard/src/CommandPanel.tsx +147 -0
  196. package/examples/dashboard/src/ConnManager.ts +85 -0
  197. package/examples/dashboard/src/DeviceActionsForm.tsx +133 -0
  198. package/examples/dashboard/src/DeviceAttrsForm.tsx +49 -0
  199. package/examples/dashboard/src/DeviceLineChart.tsx +139 -0
  200. package/examples/dashboard/src/DevicePanel.tsx +135 -0
  201. package/examples/dashboard/src/DevicesPanel.tsx +57 -0
  202. package/examples/dashboard/src/DispLedGrid.tsx +110 -0
  203. package/examples/dashboard/src/DispOneLed.tsx +20 -0
  204. package/examples/dashboard/src/Main.tsx +106 -0
  205. package/examples/dashboard/src/StatusPanel.tsx +71 -0
  206. package/examples/dashboard/src/SystemTypeCog/CogStateInfo.ts +157 -0
  207. package/examples/dashboard/src/SystemTypeCog/SystemTypeCog.ts +84 -0
  208. package/examples/dashboard/src/SystemTypeMarty/RICAddOn.ts +70 -0
  209. package/examples/dashboard/src/SystemTypeMarty/RICAddOnBase.ts +33 -0
  210. package/examples/dashboard/src/SystemTypeMarty/RICAddOnManager.ts +342 -0
  211. package/examples/dashboard/src/SystemTypeMarty/RICCommsStats.ts +170 -0
  212. package/examples/dashboard/src/SystemTypeMarty/RICHWElem.ts +123 -0
  213. package/examples/dashboard/src/SystemTypeMarty/RICLEDPatternChecker.ts +207 -0
  214. package/examples/dashboard/src/SystemTypeMarty/RICROSSerial.ts +464 -0
  215. package/examples/dashboard/src/SystemTypeMarty/RICServoFaultDetector.ts +146 -0
  216. package/examples/dashboard/src/SystemTypeMarty/RICStateInfo.ts +78 -0
  217. package/examples/dashboard/src/SystemTypeMarty/RICSystemUtils.ts +371 -0
  218. package/examples/dashboard/src/SystemTypeMarty/RICTypes.ts +20 -0
  219. package/examples/dashboard/src/SystemTypeMarty/SystemTypeMarty.ts +116 -0
  220. package/examples/dashboard/src/index.html +15 -0
  221. package/examples/dashboard/src/index.tsx +15 -0
  222. package/examples/dashboard/src/styles.css +386 -0
  223. package/examples/dashboard/tsconfig.json +18 -0
  224. package/jest.config.js +11 -0
  225. package/package.json +59 -0
  226. package/src/RaftAttributeHandler.ts +289 -0
  227. package/src/RaftChannel.ts +30 -0
  228. package/src/RaftChannelBLE.native.ts +583 -0
  229. package/src/RaftChannelBLE.web.ts +362 -0
  230. package/src/RaftChannelBLEFactory.ts +13 -0
  231. package/src/RaftChannelBLEScanner.native.ts +190 -0
  232. package/src/RaftChannelWebSerial.ts +409 -0
  233. package/src/RaftChannelWebSocket.ts +245 -0
  234. package/src/RaftCommsStats.ts +142 -0
  235. package/src/RaftConnEvents.ts +58 -0
  236. package/src/RaftConnector.ts +737 -0
  237. package/src/RaftCustomAttrHandler.ts +54 -0
  238. package/src/RaftDeviceInfo.ts +98 -0
  239. package/src/RaftDeviceManager.ts +436 -0
  240. package/src/RaftDeviceMgrIF.ts +28 -0
  241. package/src/RaftDeviceMsg.ts +20 -0
  242. package/src/RaftDeviceStates.ts +88 -0
  243. package/src/RaftFileHandler.ts +668 -0
  244. package/src/RaftLog.ts +70 -0
  245. package/src/RaftMiniHDLC.ts +396 -0
  246. package/src/RaftMsgHandler.ts +778 -0
  247. package/src/RaftMsgTrackInfo.ts +51 -0
  248. package/src/RaftProtocolDefs.ts +46 -0
  249. package/src/RaftStreamHandler.ts +328 -0
  250. package/src/RaftSystemType.ts +29 -0
  251. package/src/RaftSystemUtils.ts +487 -0
  252. package/src/RaftTypes.ts +281 -0
  253. package/src/RaftUpdateEvents.ts +48 -0
  254. package/src/RaftUpdateManager.ts +778 -0
  255. package/src/RaftUtils.ts +484 -0
  256. package/src/RaftWifiTypes.ts +36 -0
  257. package/src/main.ts +36 -0
  258. package/testdata/TestDeviceTypeRecs.json +492 -0
  259. package/tsconfig.json +30 -0
  260. package/tsconfig.react-native.json +29 -0
@@ -0,0 +1,386 @@
1
+ /* Main.css */
2
+
3
+ /* General styling for the dark theme */
4
+ body,
5
+ .device-panel,
6
+ .device-block-heading,
7
+ .device-attrs-and-actions,
8
+ .device-attrs-form,
9
+ .device-actions-form,
10
+ .device-line-chart {
11
+ /* Dark background for all components */
12
+ color: #fff;
13
+ /* Light text for better readability */
14
+ font-family: 'Segoe UI', 'Roboto', 'Oxygen',
15
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
16
+ sans-serif;
17
+ -webkit-font-smoothing: antialiased;
18
+ -moz-osx-font-smoothing: grayscale;
19
+ background-color: #282c34;
20
+ color: #ffffff;
21
+ }
22
+
23
+ code {
24
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
25
+ monospace;
26
+ }
27
+
28
+ .header {
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: space-between;
32
+ padding: 10px 20px;
33
+ border: 1px solid #666;
34
+ /* Adjusting border color for dark theme */
35
+ border-radius: 8px;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ h1 {
40
+ margin: 0;
41
+ }
42
+
43
+ .always-enabled {
44
+ pointer-events: auto !important;
45
+ /* Ensures interactions are always enabled */
46
+ }
47
+
48
+ .content-body {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 10px;
52
+ }
53
+
54
+ .content-row {
55
+ display: flex;
56
+ justify-content: space-between;
57
+ margin-bottom: 10px;
58
+ flex-direction: col;
59
+ }
60
+
61
+ .conn-indication {
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ padding: 10px;
66
+ border-radius: 8px;
67
+ margin-bottom: 10px;
68
+ }
69
+
70
+ .action-button {
71
+ color: #fff;
72
+ cursor: pointer;
73
+ background-color: #007bff;
74
+ border: none;
75
+ border-radius: 4px;
76
+ padding: 10px 20px;
77
+ font-size: 1rem;
78
+ }
79
+
80
+ .info-boxes {
81
+ display: flex;
82
+ justify-content: flex-start;
83
+ margin-bottom: 10px;
84
+ gap: 10px;
85
+ }
86
+
87
+ .connected-panel {
88
+ display: flex;
89
+ justify-content: flex-start;
90
+ gap: 20px;
91
+ align-items: stretch;
92
+ flex-direction: row;
93
+ width: 100%;
94
+ /* Space between the Connected panel and StatusPanel */
95
+ }
96
+
97
+ .info-box {
98
+ display: flex;
99
+ flex-direction: column;
100
+ align-items: center;
101
+ border-radius: 10px;
102
+ padding: 10px 20px;
103
+ border: 1px solid #666;
104
+ }
105
+
106
+ .ip-addr-input {
107
+ border: 1px solid #ccc;
108
+ border-radius: 4px;
109
+ margin-bottom: 10px;
110
+ padding: 10px;
111
+ width: 100%;
112
+ }
113
+
114
+ .command-input {
115
+ padding: 10px;
116
+ margin-bottom: 10px;
117
+ border: 1px solid #ccc;
118
+ border-radius: 4px;
119
+ }
120
+
121
+ .send-command-button {
122
+ padding: 10px 20px;
123
+ border: none;
124
+ border-radius: 4px;
125
+ background-color: #007bff;
126
+ color: white;
127
+ cursor: pointer;
128
+ font-size: 1rem;
129
+ }
130
+
131
+ .send-command-button:hover {
132
+ background-color: #0056b3;
133
+ }
134
+
135
+ .info {
136
+ display: flex;
137
+ flex-direction: column;
138
+ justify-content: space-between;
139
+ }
140
+
141
+ .info-line {
142
+ display: flex;
143
+ justify-content: space-between;
144
+ }
145
+
146
+ .info-label {
147
+ font-weight: bold;
148
+ margin-right: 10px;
149
+ }
150
+
151
+ .info-value {
152
+ font-weight: normal;
153
+ }
154
+
155
+ .info-columns {
156
+ display: flex;
157
+ gap: 20px;
158
+ }
159
+
160
+ .info-column {
161
+ display: flex;
162
+ flex-direction: column;
163
+ }
164
+
165
+ .collapsible-section {
166
+ display: flex;
167
+ flex-direction: column;
168
+ margin-bottom: 10px;
169
+ }
170
+
171
+ .collapsible-header {
172
+ background-color: #444;
173
+ color: #fff;
174
+ border: none;
175
+ padding: 10px;
176
+ cursor: pointer;
177
+ text-align: left;
178
+ width: 100%;
179
+ font-size: 16px;
180
+ outline: none;
181
+ border-radius: 4px;
182
+ }
183
+
184
+ .collapsible-content {
185
+ padding: 10px;
186
+ background-color: #333;
187
+ border: 1px solid #666;
188
+ border-radius: 4px;
189
+ }
190
+
191
+ .command-input-column {
192
+ display: flex;
193
+ flex-direction: column;
194
+ }
195
+
196
+ .example-commands-column {
197
+ display: flex;
198
+ flex-direction: column;
199
+ }
200
+
201
+ .example-command {
202
+ display: flex;
203
+ justify-content: space-between;
204
+ align-items: center;
205
+ margin-bottom: 5px;
206
+ }
207
+
208
+ .example-load-button {
209
+ padding: 5px 10px;
210
+ background-color: #007bff;
211
+ border: none;
212
+ border-radius: 4px;
213
+ color: #fff;
214
+ cursor: pointer;
215
+ margin-left: 10px;
216
+ font-size: 1rem;
217
+ }
218
+
219
+ .example-load-button:hover {
220
+ background-color: #0056b3;
221
+ }
222
+
223
+ /* Style for the overall container that holds all devices */
224
+ .devices-container {
225
+ display: flex;
226
+ flex-direction: column;
227
+ gap: 10px;
228
+ /* Adds space between each DeviceScreen */
229
+ }
230
+
231
+ /* Style for each individual device screen */
232
+ .device-panel {
233
+ display: flex;
234
+ flex-direction: column;
235
+ /* Stack heading and data blocks vertically */
236
+ gap: 10px;
237
+ /* Adds space between the heading and the data block */
238
+ padding: 10px;
239
+ border: 1px solid #666;
240
+ /* Adjusting border color for dark theme */
241
+ border-radius: 8px;
242
+ }
243
+
244
+ .device-panel.offline {
245
+ opacity: 0.5;
246
+ /* Reduces the opacity to 50% */
247
+ background-color: rgba(50, 50, 50, 0.8);
248
+ /* Optional: Adds a grey tint */
249
+ pointer-events: none;
250
+ /* Disables interactions with all child elements */
251
+ }
252
+
253
+ /* Style for the device heading */
254
+ .device-block-heading {
255
+ display: flex;
256
+ padding: 5px 10px;
257
+ /* Padding inside the heading block */
258
+ background: #444;
259
+ /* Slightly lighter dark background for distinction */
260
+ border-radius: 4px;
261
+ /* Slight rounding of corners */
262
+ }
263
+
264
+ /* Style for the text inside the heading */
265
+ .device-block-heading-text {
266
+ font-weight: bold;
267
+ /* Keep heading text bold */
268
+ }
269
+
270
+ /* Style for the data block containing the form and chart */
271
+ .device-block-data {
272
+ display: flex;
273
+ gap: 20px;
274
+ /* Space between the form and the chart */
275
+ align-items: flex-start;
276
+ /* Align items at their top edge */
277
+ min-height: 10rem;
278
+ /* Minimum height to ensure sufficient visibility */
279
+ }
280
+
281
+ .device-attrs-and-actions {
282
+ display: flex;
283
+ flex-direction: column;
284
+ gap: 10px;
285
+ /* Space between the form and the actions */
286
+ }
287
+
288
+
289
+ /* Styles for the form and chart to adjust space */
290
+ .device-attrs-form {
291
+ flex: 0 1 auto;
292
+ /* Don't grow, but allow shrinking */
293
+ width: auto;
294
+ /* Adjust based on content or set a max-width */
295
+ min-width: 200px;
296
+ /* Ensure it doesn't shrink too much */
297
+ padding: 10px;
298
+ border: 1px solid #666;
299
+ /* Adjusting border color for dark theme */
300
+ border-radius: 4px;
301
+ background: #444;
302
+ /* Slightly lighter dark background for distinction */
303
+ }
304
+
305
+ .device-actions-form {
306
+ flex: 0 1 auto;
307
+ /* Don't grow, but allow shrinking */
308
+ width: auto;
309
+ /* Adjust based on content or set a max-width */
310
+ min-width: 200px;
311
+ /* Ensure it doesn't shrink too much */
312
+ padding: 10px;
313
+ border: 1px solid #666;
314
+ /* Adjusting border color for dark theme */
315
+ border-radius: 4px;
316
+ background: #444;
317
+ /* Slightly lighter dark background for distinction */
318
+ }
319
+
320
+ .device-line-chart {
321
+ flex: 1 1 auto;
322
+ min-width: 50%;
323
+ padding: 10px;
324
+ border: 1px solid #666;
325
+ /* Adjusting border color for dark theme */
326
+ border-radius: 4px;
327
+ min-height: 15rem;
328
+ /* Setting a minimum height to ensure the chart is clearly visible */
329
+ height: 25vh;
330
+ /* Chart is approximately 1/4 of the viewport height in landscape */
331
+ }
332
+
333
+ .menu-icon,
334
+ .header-menu-icon {
335
+ cursor: pointer;
336
+ font-size: 1.5rem;
337
+ margin-left: auto;
338
+ margin-right: 10px;
339
+ color: #fff;
340
+ }
341
+
342
+ .dropdown-menu {
343
+ position: absolute;
344
+ right: 70px;
345
+ background-color: #444;
346
+ border: 1px solid #666;
347
+ border-radius: 4px;
348
+ padding: 5px;
349
+ z-index: 10;
350
+ }
351
+
352
+ .menu-item {
353
+ padding: 10px;
354
+ cursor: pointer;
355
+ color: #fff;
356
+ }
357
+
358
+ .menu-item:hover {
359
+ background-color: #555;
360
+ }
361
+
362
+ /* Adjust height for portrait orientation */
363
+ @media (orientation: portrait) {
364
+ .device-line-chart {
365
+ height: 16.67vh;
366
+ /* Chart is approximately 1/6 of the viewport height in portrait */
367
+ }
368
+ }
369
+
370
+ /* Responsive adjustments for smaller screens */
371
+ @media (max-width: 600px) {
372
+
373
+ .device-line-chart,
374
+ .device-attrs-form {
375
+ height: 25vh;
376
+ /* Adjust height to a suitable value on small screens */
377
+ }
378
+ }
379
+
380
+ /* Considerations for very large screens or high aspect ratios */
381
+ @media (min-width: 1200px) {
382
+ .device-line-chart {
383
+ height: 20vh;
384
+ /* Slightly reduce the height for very wide screens */
385
+ }
386
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "esModuleInterop": true,
5
+ "resolveJsonModule": true,
6
+ "module": "esnext",
7
+ "target": "es5",
8
+ "strict": true,
9
+ "moduleResolution": "node",
10
+ "lib": [
11
+ "ES2017",
12
+ "DOM"
13
+ ]
14
+ },
15
+ "include": [
16
+ "src"
17
+ ]
18
+ }
package/jest.config.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ roots: ['<rootDir>'],
3
+ testMatch: [
4
+ "**/__tests__/**/*.+(ts|tsx|js)",
5
+ "**/?(*.)+(spec|test).+(ts|tsx|js)"
6
+ ],
7
+ transform: {
8
+ "^.+\\.(ts|tsx)$": "ts-jest"
9
+ },
10
+ }
11
+
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@robotical/raftjs",
3
+ "version": "1.3.3",
4
+ "description": "Javascript/TS library for Raft library",
5
+ "main": "dist/web/main.js",
6
+ "types": "dist/web/main.d.ts",
7
+ "react-native": "dist/react-native/main.js",
8
+ "author": "Rob Dobson <rob@dobson.com>",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/robdobsn/raftjs.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/robdobsn/raftjs/issues"
15
+ },
16
+ "license": "MIT",
17
+ "keywords": [
18
+ "Raft"
19
+ ],
20
+ "publishConfig": {
21
+ "registry": "https://registry.npmjs.org/",
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.json",
26
+ "build:phone": "tsc -p tsconfig.react-native.json",
27
+ "build-all": "npm run clean && npm run build && npm run build:phone",
28
+ "test": "jest",
29
+ "lint": "eslint ./src",
30
+ "clean": "rm -rf dist build package",
31
+ "docs": "typedoc --entryPoints src/main.ts",
32
+ "watch-all": "tsc -p tsconfig.json --watch & tsc -p tsconfig.react-native.json --watch"
33
+ },
34
+ "devDependencies": {
35
+ "@types/jest": "^29.5.12",
36
+ "@types/node": "^20.14.0",
37
+ "@types/python-struct": "^1.0.4",
38
+ "@types/semver": "^7.5.8",
39
+ "@types/web-bluetooth": "^0.0.20",
40
+ "@typescript-eslint/eslint-plugin": "^8.6.0",
41
+ "eslint": "^9.4.0",
42
+ "jest": "^29.7.0",
43
+ "react-native-ble-plx": "^3.2.1",
44
+ "ts-jest": "^29.1.4",
45
+ "typescript": "^5.4.5"
46
+ },
47
+ "dependencies": {
48
+ "@types/text-encoding": "^0.0.39",
49
+ "axios": "^1.7.2",
50
+ "isomorphic-ws": "^5.0.0",
51
+ "python-struct": "^1.1.3",
52
+ "semver": "^7.6.2",
53
+ "text-encoding": "^0.7.0",
54
+ "tslib": "^2.6.2"
55
+ },
56
+ "peerDependencies": {
57
+ "react-native-ble-plx": "^3.2.1"
58
+ }
59
+ }