@seedtactics/insight-client 16.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +37 -0
  2. package/dist/cell-status/buffers.d.ts +36 -0
  3. package/dist/cell-status/buffers.js +127 -0
  4. package/dist/cell-status/current-status.d.ts +30 -0
  5. package/dist/cell-status/current-status.js +200 -0
  6. package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
  7. package/dist/cell-status/estimated-cycle-times.js +257 -0
  8. package/dist/cell-status/inspections.d.ts +55 -0
  9. package/dist/cell-status/inspections.js +213 -0
  10. package/dist/cell-status/loading.d.ts +26 -0
  11. package/dist/cell-status/loading.js +112 -0
  12. package/dist/cell-status/material-details.d.ts +116 -0
  13. package/dist/cell-status/material-details.js +422 -0
  14. package/dist/cell-status/material-summary.d.ts +52 -0
  15. package/dist/cell-status/material-summary.js +312 -0
  16. package/dist/cell-status/names.d.ts +19 -0
  17. package/dist/cell-status/names.js +134 -0
  18. package/dist/cell-status/pallet-cycles.d.ts +24 -0
  19. package/dist/cell-status/pallet-cycles.js +78 -0
  20. package/dist/cell-status/rebookings.d.ts +30 -0
  21. package/dist/cell-status/rebookings.js +139 -0
  22. package/dist/cell-status/scheduled-jobs.d.ts +18 -0
  23. package/dist/cell-status/scheduled-jobs.js +94 -0
  24. package/dist/cell-status/sim-day-usage.d.ts +14 -0
  25. package/dist/cell-status/sim-day-usage.js +54 -0
  26. package/dist/cell-status/sim-production.d.ts +22 -0
  27. package/dist/cell-status/sim-production.js +91 -0
  28. package/dist/cell-status/sim-station-use.d.ts +25 -0
  29. package/dist/cell-status/sim-station-use.js +71 -0
  30. package/dist/cell-status/station-cycles.d.ts +34 -0
  31. package/dist/cell-status/station-cycles.js +145 -0
  32. package/dist/cell-status/tool-replacements.d.ts +44 -0
  33. package/dist/cell-status/tool-replacements.js +155 -0
  34. package/dist/cell-status/tool-usage.d.ts +25 -0
  35. package/dist/cell-status/tool-usage.js +95 -0
  36. package/dist/components/App.d.ts +15 -0
  37. package/dist/components/App.js +549 -0
  38. package/dist/components/AxisAndGrid.d.ts +51 -0
  39. package/dist/components/AxisAndGrid.js +47 -0
  40. package/dist/components/BarcodeScanning.d.ts +6 -0
  41. package/dist/components/BarcodeScanning.js +150 -0
  42. package/dist/components/ChartTooltip.d.ts +28 -0
  43. package/dist/components/ChartTooltip.js +95 -0
  44. package/dist/components/ChooseMode.d.ts +18 -0
  45. package/dist/components/ChooseMode.js +136 -0
  46. package/dist/components/ChooseOperator.d.ts +1 -0
  47. package/dist/components/ChooseOperator.js +93 -0
  48. package/dist/components/ErrorsAndLoading.d.ts +9 -0
  49. package/dist/components/ErrorsAndLoading.js +55 -0
  50. package/dist/components/LoadingIcon.d.ts +1 -0
  51. package/dist/components/LoadingIcon.js +48 -0
  52. package/dist/components/LogEntry.d.ts +16 -0
  53. package/dist/components/LogEntry.js +365 -0
  54. package/dist/components/ManualSerialEntry.d.ts +5 -0
  55. package/dist/components/ManualSerialEntry.js +91 -0
  56. package/dist/components/MonthSelect.d.ts +6 -0
  57. package/dist/components/MonthSelect.js +67 -0
  58. package/dist/components/Navigation.d.ts +23 -0
  59. package/dist/components/Navigation.js +120 -0
  60. package/dist/components/VerboseLogging.d.ts +1 -0
  61. package/dist/components/VerboseLogging.js +47 -0
  62. package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
  63. package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
  64. package/dist/components/analysis/BufferChart.d.ts +1 -0
  65. package/dist/components/analysis/BufferChart.js +139 -0
  66. package/dist/components/analysis/CostPerPiece.d.ts +2 -0
  67. package/dist/components/analysis/CostPerPiece.js +175 -0
  68. package/dist/components/analysis/CycleChart.d.ts +42 -0
  69. package/dist/components/analysis/CycleChart.js +281 -0
  70. package/dist/components/analysis/DataTable.d.ts +83 -0
  71. package/dist/components/analysis/DataTable.js +215 -0
  72. package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
  73. package/dist/components/analysis/EfficiencyPage.js +138 -0
  74. package/dist/components/analysis/HeatChart.d.ts +22 -0
  75. package/dist/components/analysis/HeatChart.js +161 -0
  76. package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
  77. package/dist/components/analysis/InspectionDataTable.js +148 -0
  78. package/dist/components/analysis/InspectionSankey.d.ts +12 -0
  79. package/dist/components/analysis/InspectionSankey.js +140 -0
  80. package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
  81. package/dist/components/analysis/PalletCycleCards.js +137 -0
  82. package/dist/components/analysis/PartCycleCards.d.ts +2 -0
  83. package/dist/components/analysis/PartCycleCards.js +331 -0
  84. package/dist/components/analysis/QualityPage.d.ts +1 -0
  85. package/dist/components/analysis/QualityPage.js +49 -0
  86. package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
  87. package/dist/components/analysis/ScheduleHistory.js +108 -0
  88. package/dist/components/analysis/StationDataTable.d.ts +25 -0
  89. package/dist/components/analysis/StationDataTable.js +246 -0
  90. package/dist/components/analysis/ToolReplacements.d.ts +1 -0
  91. package/dist/components/analysis/ToolReplacements.js +370 -0
  92. package/dist/components/operations/AllMaterial.d.ts +5 -0
  93. package/dist/components/operations/AllMaterial.js +267 -0
  94. package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
  95. package/dist/components/operations/ChartRangeEdit.js +148 -0
  96. package/dist/components/operations/CloseoutReport.d.ts +2 -0
  97. package/dist/components/operations/CloseoutReport.js +172 -0
  98. package/dist/components/operations/CompletedParts.d.ts +2 -0
  99. package/dist/components/operations/CompletedParts.js +286 -0
  100. package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
  101. package/dist/components/operations/CurrentWorkorders.js +368 -0
  102. package/dist/components/operations/Dashboard.d.ts +2 -0
  103. package/dist/components/operations/Dashboard.js +90 -0
  104. package/dist/components/operations/OEEChart.d.ts +10 -0
  105. package/dist/components/operations/OEEChart.js +173 -0
  106. package/dist/components/operations/Outliers.d.ts +4 -0
  107. package/dist/components/operations/Outliers.js +69 -0
  108. package/dist/components/operations/ProgramHighlight.d.ts +1 -0
  109. package/dist/components/operations/ProgramHighlight.js +9 -0
  110. package/dist/components/operations/Programs.d.ts +5 -0
  111. package/dist/components/operations/Programs.js +363 -0
  112. package/dist/components/operations/Rebookings.d.ts +1 -0
  113. package/dist/components/operations/Rebookings.js +213 -0
  114. package/dist/components/operations/RecentCycleChart.d.ts +4 -0
  115. package/dist/components/operations/RecentCycleChart.js +240 -0
  116. package/dist/components/operations/RecentProduction.d.ts +2 -0
  117. package/dist/components/operations/RecentProduction.js +213 -0
  118. package/dist/components/operations/RecentSchedules.d.ts +12 -0
  119. package/dist/components/operations/RecentSchedules.js +180 -0
  120. package/dist/components/operations/RecentStationCycles.d.ts +4 -0
  121. package/dist/components/operations/RecentStationCycles.js +159 -0
  122. package/dist/components/operations/ShiftSettings.d.ts +6 -0
  123. package/dist/components/operations/ShiftSettings.js +134 -0
  124. package/dist/components/operations/SimDayUsage.d.ts +1 -0
  125. package/dist/components/operations/SimDayUsage.js +133 -0
  126. package/dist/components/operations/ToolReport.d.ts +3 -0
  127. package/dist/components/operations/ToolReport.js +233 -0
  128. package/dist/components/operations/WorkorderGantt.d.ts +1 -0
  129. package/dist/components/operations/WorkorderGantt.js +124 -0
  130. package/dist/components/quality/QualityMaterial.d.ts +2 -0
  131. package/dist/components/quality/QualityMaterial.js +169 -0
  132. package/dist/components/quality/QualityPaths.d.ts +1 -0
  133. package/dist/components/quality/QualityPaths.js +53 -0
  134. package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
  135. package/dist/components/quality/RecentFailedInspections.js +123 -0
  136. package/dist/components/routes.d.ts +170 -0
  137. package/dist/components/routes.js +301 -0
  138. package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
  139. package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
  140. package/dist/components/station-monitor/Closeout.d.ts +5 -0
  141. package/dist/components/station-monitor/Closeout.js +162 -0
  142. package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
  143. package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
  144. package/dist/components/station-monitor/Inspection.d.ts +8 -0
  145. package/dist/components/station-monitor/Inspection.js +164 -0
  146. package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
  147. package/dist/components/station-monitor/InvalidateCycle.js +262 -0
  148. package/dist/components/station-monitor/JobDetails.d.ts +7 -0
  149. package/dist/components/station-monitor/JobDetails.js +108 -0
  150. package/dist/components/station-monitor/LoadStation.d.ts +10 -0
  151. package/dist/components/station-monitor/LoadStation.js +450 -0
  152. package/dist/components/station-monitor/Material.d.ts +77 -0
  153. package/dist/components/station-monitor/Material.js +489 -0
  154. package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
  155. package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
  156. package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
  157. package/dist/components/station-monitor/PrintedLabel.js +166 -0
  158. package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
  159. package/dist/components/station-monitor/QuarantineButton.js +184 -0
  160. package/dist/components/station-monitor/Queues.d.ts +23 -0
  161. package/dist/components/station-monitor/Queues.js +312 -0
  162. package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
  163. package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
  164. package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
  165. package/dist/components/station-monitor/SelectInspType.js +99 -0
  166. package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
  167. package/dist/components/station-monitor/SelectWorkorder.js +100 -0
  168. package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
  169. package/dist/components/station-monitor/StationToolbar.js +168 -0
  170. package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
  171. package/dist/components/station-monitor/SystemOverview.js +439 -0
  172. package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
  173. package/dist/components/station-monitor/Whiteboard.js +67 -0
  174. package/dist/data/all-material-bins.d.ts +45 -0
  175. package/dist/data/all-material-bins.js +224 -0
  176. package/dist/data/chart-times.d.ts +20 -0
  177. package/dist/data/chart-times.js +99 -0
  178. package/dist/data/cost-per-piece.d.ts +32 -0
  179. package/dist/data/cost-per-piece.js +183 -0
  180. package/dist/data/current-cycles.d.ts +13 -0
  181. package/dist/data/current-cycles.js +144 -0
  182. package/dist/data/inspection-sankey.d.ts +15 -0
  183. package/dist/data/inspection-sankey.js +147 -0
  184. package/dist/data/move-arrows.d.ts +48 -0
  185. package/dist/data/move-arrows.js +217 -0
  186. package/dist/data/operators.d.ts +2 -0
  187. package/dist/data/operators.js +44 -0
  188. package/dist/data/part-summary.d.ts +17 -0
  189. package/dist/data/part-summary.js +107 -0
  190. package/dist/data/path-lookup.d.ts +13 -0
  191. package/dist/data/path-lookup.js +107 -0
  192. package/dist/data/queue-material.d.ts +46 -0
  193. package/dist/data/queue-material.js +256 -0
  194. package/dist/data/results.bufferchart.d.ts +10 -0
  195. package/dist/data/results.bufferchart.js +90 -0
  196. package/dist/data/results.completed-parts.d.ts +26 -0
  197. package/dist/data/results.completed-parts.js +181 -0
  198. package/dist/data/results.cycles.d.ts +86 -0
  199. package/dist/data/results.cycles.js +454 -0
  200. package/dist/data/results.inspection.d.ts +36 -0
  201. package/dist/data/results.inspection.js +188 -0
  202. package/dist/data/results.oee.d.ts +40 -0
  203. package/dist/data/results.oee.js +330 -0
  204. package/dist/data/results.schedules.d.ts +23 -0
  205. package/dist/data/results.schedules.js +157 -0
  206. package/dist/data/tools-programs.d.ts +78 -0
  207. package/dist/data/tools-programs.js +376 -0
  208. package/dist/index.d.ts +1 -0
  209. package/dist/index.js +60 -0
  210. package/dist/network/api.d.ts +1390 -0
  211. package/dist/network/api.js +4971 -0
  212. package/dist/network/backend-mock.d.ts +11 -0
  213. package/dist/network/backend-mock.js +512 -0
  214. package/dist/network/backend.d.ts +57 -0
  215. package/dist/network/backend.js +77 -0
  216. package/dist/network/load-specific-month.d.ts +13 -0
  217. package/dist/network/load-specific-month.js +77 -0
  218. package/dist/network/server-settings.d.ts +12 -0
  219. package/dist/network/server-settings.js +92 -0
  220. package/dist/network/websocket.d.ts +4 -0
  221. package/dist/network/websocket.js +165 -0
  222. package/dist/renderer.d.ts +8 -0
  223. package/dist/renderer.js +55 -0
  224. package/dist/seedtactics-logo.d.ts +2 -0
  225. package/dist/seedtactics-logo.js +4 -0
  226. package/dist/util/chart-colors.d.ts +1 -0
  227. package/dist/util/chart-colors.js +116 -0
  228. package/dist/util/chart-helpers.d.ts +3 -0
  229. package/dist/util/chart-helpers.js +51 -0
  230. package/dist/util/parseISODuration.d.ts +4 -0
  231. package/dist/util/parseISODuration.js +40 -0
  232. package/docs/client-efficiency.md +355 -0
  233. package/docs/client-engineering.md +54 -0
  234. package/docs/client-launch.md +55 -0
  235. package/docs/client-operations.md +88 -0
  236. package/docs/client-quality.md +74 -0
  237. package/docs/client-sales.md +61 -0
  238. package/docs/client-scanners.md +41 -0
  239. package/docs/client-station-monitor.md +149 -0
  240. package/docs/client-tools-programs.md +74 -0
  241. package/docs/improve-fms.md +141 -0
  242. package/docs/makino.md +40 -0
  243. package/docs/material-quarantine.md +82 -0
  244. package/docs/material-tracking.md +236 -0
  245. package/docs/mazak.md +115 -0
  246. package/docs/niigata.md +228 -0
  247. package/docs/operator-procedures.md +106 -0
  248. package/docs/part-instructions.md +63 -0
  249. package/docs/screenshots/insight-all-material.png +0 -0
  250. package/docs/screenshots/insight-analysis-pallets.png +0 -0
  251. package/docs/screenshots/insight-analysis-part-completed.png +0 -0
  252. package/docs/screenshots/insight-analysis-sankey.png +0 -0
  253. package/docs/screenshots/insight-analysis-station-oee.png +0 -0
  254. package/docs/screenshots/insight-buffer-occupancy.png +0 -0
  255. package/docs/screenshots/insight-choose-analysis-month.png +0 -0
  256. package/docs/screenshots/insight-closeout.png +0 -0
  257. package/docs/screenshots/insight-cost-percentages.png +0 -0
  258. package/docs/screenshots/insight-dashboard.png +0 -0
  259. package/docs/screenshots/insight-event-custom-view.jpg +0 -0
  260. package/docs/screenshots/insight-event-viewer.jpg +0 -0
  261. package/docs/screenshots/insight-inspection.png +0 -0
  262. package/docs/screenshots/insight-load-station-details.png +0 -0
  263. package/docs/screenshots/insight-load-station.png +0 -0
  264. package/docs/screenshots/insight-loadcycle-graph.png +0 -0
  265. package/docs/screenshots/insight-loadstation-small.jpg +0 -0
  266. package/docs/screenshots/insight-machinecycle-graph.png +0 -0
  267. package/docs/screenshots/insight-machinecycle-table.png +0 -0
  268. package/docs/screenshots/insight-machinecycles.png +0 -0
  269. package/docs/screenshots/insight-machinehours.png +0 -0
  270. package/docs/screenshots/insight-machineoutliers.png +0 -0
  271. package/docs/screenshots/insight-monthly-schedules.png +0 -0
  272. package/docs/screenshots/insight-operations-material.png +0 -0
  273. package/docs/screenshots/insight-operations-overview.png +0 -0
  274. package/docs/screenshots/insight-operations-reports.png +0 -0
  275. package/docs/screenshots/insight-part-cost.png +0 -0
  276. package/docs/screenshots/insight-program-report.png +0 -0
  277. package/docs/screenshots/insight-quality-material-details.png +0 -0
  278. package/docs/screenshots/insight-quality-material.png +0 -0
  279. package/docs/screenshots/insight-quality-quarantine.png +0 -0
  280. package/docs/screenshots/insight-quality-sankey.png +0 -0
  281. package/docs/screenshots/insight-quality-similar-paths.png +0 -0
  282. package/docs/screenshots/insight-queue-details.png +0 -0
  283. package/docs/screenshots/insight-queues-jobs-table.png +0 -0
  284. package/docs/screenshots/insight-queues.png +0 -0
  285. package/docs/screenshots/insight-sim-day-usage.png +0 -0
  286. package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
  287. package/docs/screenshots/insight-station-system-overview.png +0 -0
  288. package/docs/screenshots/insight-system-overview.png +0 -0
  289. package/docs/screenshots/insight-tool-replacements.png +0 -0
  290. package/docs/screenshots/insight-tool-report.png +0 -0
  291. package/docs/screenshots/insight-toolbar-btns.png +0 -0
  292. package/docs/screenshots/insight-workorder-gantt.png +0 -0
  293. package/docs/screenshots/insight-workorders.png +0 -0
  294. package/docs/security.md +131 -0
  295. package/docs/server-config.md +56 -0
  296. package/docs/server-errors.md +44 -0
  297. package/package.json +90 -0
  298. package/src/index.ts +65 -0
@@ -0,0 +1,77 @@
1
+ /* Copyright (c) 2021, John Lenz
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
17
+ nor the names of other contributors may be used to endorse or
18
+ promote products derived from this software without specific
19
+ prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import { addMonths, startOfMonth } from "date-fns";
34
+ import { onLoadSpecificMonthJobs, onLoadSpecificMonthLog } from "../cell-status/loading.js";
35
+ import { JobsBackend, LogBackend } from "./backend.js";
36
+ import { atom, useSetAtom } from "jotai";
37
+ const selectType = atom("Last30");
38
+ const selectMonth = atom(startOfMonth(new Date()));
39
+ export const selectedMonth = atom((get) => get(selectMonth), (get, set, m) => {
40
+ set(selectType, "SpecificMonth");
41
+ set(selectMonth, m);
42
+ if (get(loadedMonth) !== m && !get(loadingSpecificMonthRW)) {
43
+ loadMonth(m, set);
44
+ }
45
+ });
46
+ export const selectedAnalysisPeriod = atom((get) => {
47
+ const ty = get(selectType);
48
+ if (ty === "Last30") {
49
+ return { type: "Last30" };
50
+ }
51
+ else {
52
+ return { type: "SpecificMonth", month: get(selectMonth) };
53
+ }
54
+ });
55
+ const loadedMonth = atom(null);
56
+ const loadingSpecificMonthRW = atom(false);
57
+ export const loadingSpecificMonthData = loadingSpecificMonthRW;
58
+ const errorLoadingSpecificMonthRW = atom(null);
59
+ export const errorLoadingSpecificMonthData = errorLoadingSpecificMonthRW;
60
+ function loadMonth(month, set) {
61
+ set(loadingSpecificMonthRW, true);
62
+ set(errorLoadingSpecificMonthRW, null);
63
+ const startOfNextMonth = addMonths(month, 1);
64
+ const jobsProm = JobsBackend.history(month, startOfNextMonth).then((j) => set(onLoadSpecificMonthJobs, j));
65
+ const logProm = LogBackend.get(month, startOfNextMonth).then((log) => set(onLoadSpecificMonthLog, log));
66
+ Promise.all([jobsProm, logProm])
67
+ .then(() => set(loadedMonth, month))
68
+ .catch((e) => set(errorLoadingSpecificMonthRW, e.message ?? "Error"))
69
+ .finally(() => set(loadingSpecificMonthRW, false));
70
+ }
71
+ export function useSetLast30() {
72
+ const setLast30 = useSetAtom(selectType);
73
+ return () => setLast30("Last30");
74
+ }
75
+ export function useSetSpecificMonthWithoutLoading() {
76
+ return useSetAtom(selectMonth);
77
+ }
@@ -0,0 +1,12 @@
1
+ import { User } from "oidc-client-ts";
2
+ import * as api from "./api.js";
3
+ export interface FMSInfoAndUser extends Readonly<api.IFMSInfo> {
4
+ readonly user?: User;
5
+ }
6
+ export declare function requireLogin(fmsInfo: Readonly<api.IFMSInfo>): boolean;
7
+ export declare function loadInfo(): Promise<FMSInfoAndUser>;
8
+ export declare const fmsInformation: import("jotai").PrimitiveAtom<FMSInfoAndUser> & {
9
+ init: FMSInfoAndUser;
10
+ };
11
+ export declare function login(fmsInfo: FMSInfoAndUser): void;
12
+ export declare function logout(): void;
@@ -0,0 +1,92 @@
1
+ /* Copyright (c) 2020, John Lenz
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
17
+ nor the names of other contributors may be used to endorse or
18
+ promote products derived from this software without specific
19
+ prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import { UserManager } from "oidc-client-ts";
34
+ import { FmsServerBackend, setOtherLogBackends, setUserToken } from "./backend.js";
35
+ import { atom } from "jotai";
36
+ let userManager;
37
+ export function requireLogin(fmsInfo) {
38
+ if (!fmsInfo.openIDConnectClientId)
39
+ return false;
40
+ if (location.hostname === "localhost") {
41
+ return !!fmsInfo.localhostOpenIDConnectAuthority;
42
+ }
43
+ else {
44
+ return !!fmsInfo.openIDConnectAuthority;
45
+ }
46
+ }
47
+ export async function loadInfo() {
48
+ const fmsInfo = await FmsServerBackend.fMSInformation();
49
+ if (fmsInfo.additionalLogServers && fmsInfo.additionalLogServers.length > 0) {
50
+ setOtherLogBackends(fmsInfo.additionalLogServers);
51
+ }
52
+ let user = null;
53
+ if (requireLogin(fmsInfo)) {
54
+ userManager = new UserManager({
55
+ authority: (location.hostname === "localhost"
56
+ ? fmsInfo.localhostOpenIDConnectAuthority
57
+ : fmsInfo.openIDConnectAuthority) ?? "",
58
+ client_id: fmsInfo.openIDConnectClientId ?? "",
59
+ redirect_uri: window.location.protocol + "//" + window.location.host + "/",
60
+ post_logout_redirect_uri: window.location.protocol + "//" + window.location.host + "/",
61
+ automaticSilentRenew: true,
62
+ loadUserInfo: true,
63
+ scope: "openid profile",
64
+ });
65
+ user = await userManager.getUser();
66
+ if (!user) {
67
+ try {
68
+ user = await userManager.signinRedirectCallback();
69
+ }
70
+ catch {
71
+ user = null;
72
+ }
73
+ window.history.replaceState({}, "", "/");
74
+ }
75
+ if (user) {
76
+ setUserToken(user);
77
+ localStorage.setItem("current-operator", user.profile.name || user.profile.sub);
78
+ }
79
+ }
80
+ return { ...fmsInfo, user: user === null ? undefined : user };
81
+ }
82
+ export const fmsInformation = atom({ name: "FMS Insight", version: "" });
83
+ export function login(fmsInfo) {
84
+ if (userManager && !fmsInfo.user) {
85
+ userManager.signinRedirect().catch((e) => console.log(e));
86
+ }
87
+ }
88
+ export function logout() {
89
+ if (userManager) {
90
+ userManager.signoutRedirect().catch((e) => console.log(e));
91
+ }
92
+ }
@@ -0,0 +1,4 @@
1
+ import { Atom } from "jotai";
2
+ export declare const websocketReconnecting: Atom<boolean>;
3
+ export declare const errorLoadingLast30: Atom<string | null>;
4
+ export declare function WebsocketConnection(): null;
@@ -0,0 +1,165 @@
1
+ /* Copyright (c) 2021, John Lenz
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following
13
+ disclaimer in the documentation and/or other materials provided
14
+ with the distribution.
15
+
16
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
17
+ nor the names of other contributors may be used to endorse or
18
+ promote products derived from this software without specific
19
+ prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ */
33
+ import { ServerEvent } from "./api.js";
34
+ import { JobsBackend, LogBackend } from "./backend.js";
35
+ import { fmsInformation } from "./server-settings.js";
36
+ import { useCallback, useEffect, useRef } from "react";
37
+ import { lastEventCounter, onLoadCurrentSt, onLoadLast30Jobs, onLoadLast30Log, onServerEvent, } from "../cell-status/loading.js";
38
+ import { addDays } from "date-fns";
39
+ import { last30SchIds } from "../cell-status/scheduled-jobs.js";
40
+ import { atom, useAtomValue, useSetAtom } from "jotai";
41
+ const websocketReconnectingAtom = atom(false);
42
+ export const websocketReconnecting = websocketReconnectingAtom;
43
+ const errorLoadingLast30RW = atom(null);
44
+ export const errorLoadingLast30 = errorLoadingLast30RW;
45
+ function loadInitial(set) {
46
+ const now = new Date();
47
+ const thirtyDaysAgo = addDays(now, -30);
48
+ const curStProm = JobsBackend.currentStatus().then((st) => set(onLoadCurrentSt, st));
49
+ const jobsProm = JobsBackend.recent(thirtyDaysAgo, []).then((j) => set(onLoadLast30Jobs, j));
50
+ const logProm = LogBackend.get(thirtyDaysAgo, now).then((log) => set(onLoadLast30Log, log));
51
+ Promise.all([curStProm, jobsProm, logProm])
52
+ .catch((e) => set(errorLoadingLast30RW, e.message ?? "Error"))
53
+ .finally(() => set(websocketReconnectingAtom, false));
54
+ }
55
+ function loadMissed(lastCntr, schIds, set) {
56
+ const now = new Date();
57
+ const curStProm = JobsBackend.currentStatus().then((st) => set(onLoadCurrentSt, st));
58
+ const jobsProm = JobsBackend.recent(addDays(now, -30), schIds ? Array.from(schIds) : []).then((j) => set(onLoadLast30Jobs, j));
59
+ const logProm = LogBackend.recent(lastCntr, undefined).then((log) => set(onLoadLast30Log, log));
60
+ Promise.all([curStProm, jobsProm, logProm])
61
+ .catch((e) => set(errorLoadingLast30RW, e.message ?? "Error"))
62
+ .finally(() => set(websocketReconnectingAtom, false));
63
+ }
64
+ class ReconnectingWebsocket {
65
+ constructor(url) {
66
+ this.userCalledClose = false;
67
+ this.reconnectAttempts = 0;
68
+ this.url = url;
69
+ this.connect();
70
+ }
71
+ close() {
72
+ this.userCalledClose = true;
73
+ this.ws?.close();
74
+ }
75
+ connect() {
76
+ if (this.userCalledClose)
77
+ return;
78
+ this.ws = new WebSocket(this.url);
79
+ const localWs = this.ws;
80
+ const connectTimeout = setTimeout(() => {
81
+ localWs.close();
82
+ }, 2000);
83
+ localWs.onopen = () => {
84
+ clearTimeout(connectTimeout);
85
+ this.reconnectAttempts = 0;
86
+ this.onopen?.();
87
+ };
88
+ localWs.onclose = () => {
89
+ clearTimeout(connectTimeout);
90
+ this.ws = undefined;
91
+ if (this.userCalledClose) {
92
+ return;
93
+ }
94
+ this.onreconnecting?.();
95
+ const delay = Math.min(1000 * Math.pow(1.5, this.reconnectAttempts), 30000);
96
+ setTimeout(() => {
97
+ this.reconnectAttempts++;
98
+ this.connect();
99
+ }, delay);
100
+ };
101
+ localWs.onmessage = (evt) => {
102
+ this.onmessage?.(evt);
103
+ };
104
+ localWs.onerror = (evt) => {
105
+ console.error(evt);
106
+ };
107
+ }
108
+ }
109
+ const onOpenAtom = atom(null, (get, set) => {
110
+ const lastSeenCntr = get(lastEventCounter);
111
+ const schIds = get(last30SchIds);
112
+ set(websocketReconnectingAtom, true);
113
+ set(errorLoadingLast30RW, null);
114
+ if (lastSeenCntr !== null && lastSeenCntr !== undefined) {
115
+ loadMissed(lastSeenCntr, schIds, set);
116
+ }
117
+ else {
118
+ loadInitial(set);
119
+ }
120
+ });
121
+ const onMessageAtom = atom(null, (_, set, evt) => {
122
+ const serverEvt = ServerEvent.fromJS(JSON.parse(evt.data));
123
+ set(onServerEvent, { evt: serverEvt, now: new Date(), expire: true });
124
+ });
125
+ export function WebsocketConnection() {
126
+ const onOpen = useSetAtom(onOpenAtom);
127
+ const setReconnecting = useSetAtom(websocketReconnectingAtom);
128
+ const onReconnecting = useCallback(() => setReconnecting(true), [setReconnecting]);
129
+ const onMessage = useSetAtom(onMessageAtom);
130
+ const fmsInfoLoadable = useAtomValue(fmsInformation);
131
+ const websocketRef = useRef(null);
132
+ useEffect(() => {
133
+ if (websocketRef.current)
134
+ return;
135
+ const user = fmsInfoLoadable.user ?? null;
136
+ const loc = window.location;
137
+ let uri;
138
+ if (loc.protocol === "backup:") {
139
+ // viewing page in backup viewer, no websocket connection
140
+ return;
141
+ }
142
+ else if (loc.protocol === "https:") {
143
+ uri = "wss:";
144
+ }
145
+ else {
146
+ uri = "ws:";
147
+ }
148
+ uri += "//" + loc.host + "/api/v1/events";
149
+ if (user) {
150
+ uri += "?token=" + encodeURIComponent(user.access_token);
151
+ }
152
+ const websocket = new ReconnectingWebsocket(uri);
153
+ websocket.onopen = onOpen;
154
+ websocket.onreconnecting = onReconnecting;
155
+ websocket.onmessage = onMessage;
156
+ websocketRef.current = websocket;
157
+ return () => {
158
+ if (websocketRef.current) {
159
+ websocketRef.current.close();
160
+ websocketRef.current = null;
161
+ }
162
+ };
163
+ }, [fmsInfoLoadable, onMessage, onOpen, onReconnecting]);
164
+ return null;
165
+ }
@@ -0,0 +1,8 @@
1
+ import "highlight.js/styles/default.css";
2
+ import "@fontsource/roboto/300.css";
3
+ import "@fontsource/roboto/400.css";
4
+ import "@fontsource/roboto/500.css";
5
+ import "@fontsource/roboto/700.css";
6
+ import { AppProps } from "./components/App.js";
7
+ import { createStore } from "jotai";
8
+ export declare function render(appProps: AppProps | null, elem: HTMLElement, store: ReturnType<typeof createStore>): void;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* Copyright (c) 2021, John Lenz
3
+
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above
13
+ copyright notice, this list of conditions and the following
14
+ disclaimer in the documentation and/or other materials provided
15
+ with the distribution.
16
+
17
+ * Neither the name of John Lenz, Black Maple Software, SeedTactics,
18
+ nor the names of other contributors may be used to endorse or
19
+ promote products derived from this software without specific
20
+ prior written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ */
34
+ import { StrictMode } from "react";
35
+ import { createRoot } from "react-dom/client";
36
+ import { CssBaseline } from "@mui/material";
37
+ import "highlight.js/styles/default.css";
38
+ import "@fontsource/roboto/300.css";
39
+ import "@fontsource/roboto/400.css";
40
+ import "@fontsource/roboto/500.css";
41
+ import "@fontsource/roboto/700.css";
42
+ import { green, brown } from "@mui/material/colors";
43
+ import { ThemeProvider, createTheme } from "@mui/material/styles";
44
+ import App from "./components/App.js";
45
+ import { Provider } from "jotai";
46
+ export function render(appProps, elem, store) {
47
+ const theme = createTheme({
48
+ palette: {
49
+ primary: green,
50
+ secondary: brown,
51
+ },
52
+ });
53
+ const root = createRoot(elem);
54
+ root.render(_jsxs(ThemeProvider, { theme: theme, children: [_jsx(CssBaseline, {}), _jsx(StrictMode, { children: _jsx(Provider, { store: store, children: _jsx(App, { ...appProps }) }) })] }));
55
+ }
@@ -0,0 +1,2 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function SeedtacticLogo(): ReactNode;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function SeedtacticLogo() {
3
+ return (_jsxs("svg", { width: "30px", height: "30px", viewBox: "0 0 170 170", xmlns: "http://www.w3.org/2000/svg", children: [_jsxs("defs", { children: [_jsx("path", { id: "t", d: "m307.5 125v77.5h-40c6.92-6.52 11.25-10.6 12.98-12.23 10.65-10.04 13.56-25.81 7.21-38.99-1.7-3.5-5.92-12.26-12.69-26.28z" }), _jsx("path", { id: "ag", d: "m273.88 120.52c-0.13 0.28-4.87 3.3-11.17 0.5-6.3-2.81-11.99-9.96-11.67-10.67 0.32-0.72 9.44-1.27 15.74 1.53 6.3 2.81 7.23 8.35 7.1 8.64z" }), _jsx("path", { id: "m", d: "m259 102.25c-0.13 0.29-4.2 3.61-9.02 1.46-4.81-2.14-8.75-8.51-8.43-9.23 0.31-0.71 7.69-2.05 12.5 0.1 4.82 2.14 5.07 7.39 4.95 7.67z" }), _jsx("path", { id: "x", d: "m282.79 114.2c-0.2 0.24-5.59 1.84-10.87-2.59-5.29-4.44-8.78-12.88-8.28-13.48 0.5-0.59 9.42 1.38 14.7 5.82 5.29 4.43 4.65 10.02 4.45 10.25z" }), _jsx("path", { id: "k", d: "m268.39 125.43c-0.12-0.28-4.33-3.54-9.45-1.26s-9.41 8.81-9.1 9.52c0.32 0.71 8.05 1.89 13.17-0.39s5.51-7.58 5.38-7.87z" }), _jsx("path", { id: "ae", d: "m243.83 111.58c0 0.31-2.61 5-8.43 5s-12.65-4.22-12.65-5 6.83-5 12.65-5 8.43 4.69 8.43 5z" }), _jsx("path", { id: "l", d: "m304.24 109.88c-0.31 0.04-5.38-2.38-6.34-9.21s2.09-15.44 2.86-15.55 6.08 7.33 7.04 14.16-3.25 10.55-3.56 10.6z" }), _jsx("path", { id: "u", d: "m306.79 80.57c-0.31 0.05-5.31-1.83-6.1-7.47-0.79-5.63 2.45-12.84 3.23-12.95 0.77-0.11 5.88 5.92 6.67 11.56s-3.49 8.82-3.8 8.86z" }), _jsx("path", { id: "a", d: "m306.13 58.04c-0.31 0.05-5.23-1.3-5.86-5.74-0.62-4.43 2.83-10.24 3.6-10.34 0.77-0.11 5.68 4.51 6.31 8.95 0.62 4.44-3.74 7.09-4.05 7.13z" }), _jsx("path", { id: "f", d: "m295.52 118.45c-0.29 0.13-6.1-1.39-9.5-9.02-3.39-7.64-3.53-18.31-2.82-18.63 0.72-0.32 8.56 6.93 11.96 14.56s0.64 12.97 0.36 13.09z" }), _jsx("path", { id: "b", d: "m272.35 90.11c-0.26 0.19-5.76 0.58-9.58-4.67-3.82-5.26-4.88-13.9-4.25-14.36s8.52 3.23 12.34 8.48 1.74 10.37 1.49 10.55z" }), _jsx("path", { id: "s", d: "m289.97 85.66c-0.28 0.13-5.97-0.97-9.17-7.84-3.21-6.87-3.15-16.73-2.44-17.06s8.3 5.96 11.5 12.83 0.4 11.94 0.11 12.07z" }), _jsx("path", { id: "n", d: "m270.16 65.57c-0.28 0.14-5.38 0.38-7.35-3.65-1.96-4.03-0.48-10.62 0.22-10.96s6.8 2.54 8.77 6.58c1.97 4.03-1.36 7.9-1.64 8.03z" }), _jsx("path", { id: "ah", d: "m250 80c-0.17 0.26-4.4 3.11-8.12 0.69s-5.79-8.79-5.37-9.45c0.43-0.65 7.1-1.35 10.82 1.06 3.72 2.42 2.84 7.44 2.67 7.7z" }), _jsx("path", { id: "y", d: "m236.47 96.58c-0.11 0.29-3.72 3.89-7.83 2.23-4.12-1.66-7.37-7.53-7.07-8.25 0.29-0.72 6.7-2.68 10.81-1.02 4.12 1.66 4.21 6.75 4.09 7.04z" }), _jsx("path", { id: "aa", d: "m290.52 56.48c-0.28 0.14-5.35 0.58-7.44-3.33-2.08-3.92-0.8-10.5-0.11-10.87s6.86 2.25 8.94 6.17c2.09 3.92-1.12 7.88-1.39 8.03z" }), _jsx("path", { id: "af", d: "m274.18 138.46c-0.16-0.26-5.28-2.6-11.13 1.06s-10.48 11.53-10.07 12.19 9.52-0.05 15.37-3.71 6-9.27 5.83-9.54z" }), _jsx("path", { id: "z", d: "m247.89 137.78c0.11 0.29-0.65 5.6-6.08 7.69-5.43 2.08-13.32 0.59-13.6-0.14s4.58-7.11 10.01-9.2c5.44-2.08 9.56 1.36 9.67 1.65z" }), _jsx("path", { id: "h", d: "m235.06 125.39c0.1 0.3-0.26 5.38-4.46 6.83-4.19 1.44-10.49-0.85-10.75-1.59-0.25-0.74 3.3-6.42 7.5-7.87 4.19-1.44 7.61 2.34 7.71 2.63z" }), _jsx("path", { id: "ab", d: "m317.14 85.63c0.28 0.13 5.97-0.98 9.17-7.85 3.21-6.87 3.14-16.72 2.44-17.05-0.71-0.33-8.3 5.95-11.5 12.82-3.21 6.87-0.4 11.94-0.11 12.08z" }), _jsx("path", { id: "ac", d: "m299.61 124.96v77.5h40c-6.93-6.52-11.25-10.6-12.99-12.23-10.64-10.03-13.56-25.81-7.2-38.99 1.69-3.5 5.92-12.26 12.69-26.28z" }), _jsx("path", { id: "c", d: "m348.11 102.22c0.13 0.28 4.2 3.6 9.01 1.46 4.82-2.15 8.76-8.52 8.44-9.23-0.32-0.72-7.69-2.05-12.5 0.09-4.82 2.14-5.08 7.39-4.95 7.68z" }), _jsx("path", { id: "p", d: "m324.32 114.17c0.2 0.24 5.59 1.83 10.87-2.6 5.29-4.43 8.78-12.87 8.28-13.47s-9.42 1.38-14.71 5.81c-5.28 4.43-4.64 10.02-4.44 10.26z" }), _jsx("path", { id: "o", d: "m338.71 125.4c0.13-0.29 4.34-3.55 9.46-1.27s9.41 8.81 9.09 9.52c-0.31 0.72-8.04 1.9-13.16-0.38s-5.51-7.59-5.39-7.87z" }), _jsx("path", { id: "j", d: "m363.28 111.54c0 0.32 2.61 5 8.43 5s12.65-4.21 12.65-5c0-0.78-6.83-5-12.65-5s-8.43 4.69-8.43 5z" }), _jsx("path", { id: "w", d: "m311.59 118.42c0.29 0.12 6.1-1.4 9.49-9.03 3.4-7.63 3.54-18.31 2.82-18.63-0.71-0.32-8.55 6.93-11.95 14.56s-0.64 12.97-0.36 13.1z" }), _jsx("path", { id: "i", d: "m334.76 90.08c0.25 0.18 5.76 0.57 9.58-4.68 3.81-5.25 4.88-13.9 4.25-14.36s-8.53 3.23-12.34 8.48c-3.82 5.26-1.74 10.37-1.49 10.56z" }), _jsx("path", { id: "r", d: "m333.23 120.48c0.12 0.29 4.86 3.31 11.17 0.5 6.3-2.81 11.98-9.96 11.67-10.67-0.32-0.71-9.44-1.27-15.74 1.53-6.3 2.81-7.23 8.35-7.1 8.64z" }), _jsx("path", { id: "ad", d: "m336.95 65.54c0.28 0.13 5.38 0.38 7.35-3.66 1.96-4.03 0.48-10.61-0.22-10.96-0.7-0.34-6.81 2.55-8.77 6.58-1.97 4.03 1.36 7.9 1.64 8.04z" }), _jsx("path", { id: "ai", d: "m357.11 79.96c0.17 0.27 4.39 3.11 8.12 0.69 3.72-2.41 5.79-8.79 5.36-9.44-0.42-0.66-7.09-1.36-10.81 1.06-3.72 2.41-2.84 7.43-2.67 7.69z" }), _jsx("path", { id: "d", d: "m370.63 96.55c0.12 0.29 3.73 3.89 7.84 2.22 4.11-1.66 7.37-7.52 7.07-8.25-0.29-0.72-6.7-2.68-10.82-1.02-4.11 1.66-4.2 6.76-4.09 7.05z" }), _jsx("path", { id: "q", d: "m316.59 56.44c0.28 0.15 5.35 0.59 7.43-3.33 2.09-3.92 0.81-10.5 0.12-10.87-0.69-0.36-6.86 2.26-8.95 6.17-2.08 3.92 1.12 7.88 1.4 8.03z" }), _jsx("path", { id: "v", d: "m332.93 138.42c0.16-0.26 5.28-2.59 11.13 1.06 5.85 3.66 10.48 11.53 10.07 12.19-0.42 0.66-9.52-0.05-15.37-3.71-5.85-3.65-6-9.27-5.83-9.54z" }), _jsx("path", { id: "g", d: "m359.22 137.74c-0.11 0.29 0.65 5.61 6.08 7.69 5.43 2.09 13.32 0.59 13.6-0.13 0.28-0.73-4.59-7.12-10.02-9.21-5.43-2.08-9.55 1.36-9.66 1.65z" }), _jsx("path", { id: "e", d: "m372.05 125.36c-0.1 0.29 0.26 5.37 4.45 6.82 4.2 1.44 10.5-0.85 10.75-1.59 0.26-0.74-3.29-6.42-7.49-7.87-4.2-1.44-7.61 2.34-7.71 2.64z" })] }), _jsx("g", { transform: "translate(-219.32 -33)", visibility: "inherit", children: _jsxs("g", { visibility: "inherit", children: [_jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#t" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#t" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ag" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#ag" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#m" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#m" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#x" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#x" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#k" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#k" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ae" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#ae" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#l" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#l" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#u" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#u" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#a" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#a" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#f" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#f" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#b" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#b" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#s" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#s" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#n" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#n" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ah" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#y" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#y" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#aa" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#aa" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#af" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#af" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#z" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#z" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#h" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#h" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ab" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#ab" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ac" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#ac" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#c" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#c" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#p" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#p" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#o" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#o" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#j" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#j" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#w" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#w" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#i" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#i" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#r" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#r" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ad" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#ad" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#ai" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#d" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#d" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#q" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#q" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#v" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#v" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#g" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#g" }), _jsx("use", { width: "100%", height: "100%", fill: "#DBA72E", href: "#e" }), _jsx("use", { width: "100%", height: "100%", fillOpacity: "0", stroke: "#DBA72E", href: "#e" })] }) })] }));
4
+ }
@@ -0,0 +1 @@
1
+ export declare function seriesColor(idx: number, count: number): string;
@@ -0,0 +1,116 @@
1
+ // https://personal.sron.nl/~pault/
2
+ const paulTolQualitativeColors = [
3
+ ["4477aa"],
4
+ ["4477aa", "cc6677"],
5
+ ["4477aa", "ddcc77", "cc6677"],
6
+ ["4477aa", "117733", "ddcc77", "cc6677"],
7
+ ["332288", "88ccee", "117733", "ddcc77", "cc6677"],
8
+ ["332288", "88ccee", "117733", "ddcc77", "cc6677", "aa4499"],
9
+ ["332288", "88ccee", "44aa99", "117733", "ddcc77", "cc6677", "aa4499"],
10
+ ["332288", "88ccee", "44aa99", "117733", "999933", "ddcc77", "cc6677", "aa4499"],
11
+ ["332288", "88ccee", "44aa99", "117733", "999933", "ddcc77", "cc6677", "882255", "aa4499"],
12
+ ["332288", "88ccee", "44aa99", "117733", "999933", "ddcc77", "661100", "cc6677", "882255", "aa4499"],
13
+ [
14
+ "332288",
15
+ "6699cc",
16
+ "88ccee",
17
+ "44aa99",
18
+ "117733",
19
+ "999933",
20
+ "ddcc77",
21
+ "661100",
22
+ "cc6677",
23
+ "882255",
24
+ "aa4499",
25
+ ],
26
+ [
27
+ "332288",
28
+ "6699cc",
29
+ "88ccee",
30
+ "44aa99",
31
+ "117733",
32
+ "999933",
33
+ "ddcc77",
34
+ "661100",
35
+ "cc6677",
36
+ "aa4466",
37
+ "882255",
38
+ "aa4499",
39
+ ],
40
+ ];
41
+ // https://github.com/google/palette.js/blob/master/palette.js
42
+ const mpn65Colors = [
43
+ "ff0029",
44
+ "377eb8",
45
+ "66a61e",
46
+ "984ea3",
47
+ "00d2d5",
48
+ "ff7f00",
49
+ "af8d00",
50
+ "7f80cd",
51
+ "b3e900",
52
+ "c42e60",
53
+ "a65628",
54
+ "f781bf",
55
+ "8dd3c7",
56
+ "bebada",
57
+ "fb8072",
58
+ "80b1d3",
59
+ "fdb462",
60
+ "fccde5",
61
+ "bc80bd",
62
+ "ffed6f",
63
+ "c4eaff",
64
+ "cf8c00",
65
+ "1b9e77",
66
+ "d95f02",
67
+ "e7298a",
68
+ "e6ab02",
69
+ "a6761d",
70
+ "0097ff",
71
+ "00d067",
72
+ "000000",
73
+ "252525",
74
+ "525252",
75
+ "737373",
76
+ "969696",
77
+ "bdbdbd",
78
+ "f43600",
79
+ "4ba93b",
80
+ "5779bb",
81
+ "927acc",
82
+ "97ee3f",
83
+ "bf3947",
84
+ "9f5b00",
85
+ "f48758",
86
+ "8caed6",
87
+ "f2b94f",
88
+ "eff26e",
89
+ "e43872",
90
+ "d9b100",
91
+ "9d7a00",
92
+ "698cff",
93
+ "d9d9d9",
94
+ "00d27e",
95
+ "d06800",
96
+ "009f82",
97
+ "c49200",
98
+ "cbe8ff",
99
+ "fecddf",
100
+ "c27eb6",
101
+ "8cd2ce",
102
+ "c4b8d9",
103
+ "f883b0",
104
+ "a49100",
105
+ "f48800",
106
+ "27d0df",
107
+ "a04a9b",
108
+ ];
109
+ export function seriesColor(idx, count) {
110
+ if (count <= paulTolQualitativeColors.length) {
111
+ return "#" + paulTolQualitativeColors[count - 1][idx];
112
+ }
113
+ else {
114
+ return "#" + mpn65Colors[idx % mpn65Colors.length];
115
+ }
116
+ }
@@ -0,0 +1,3 @@
1
+ import { MouseEvent, TouchEvent } from "react";
2
+ export declare function localPoint(evt: MouseEvent<Element> | TouchEvent<Element>): DOMPoint | null;
3
+ export declare function measureSvgString(str: string, fontSize?: number): number | null;
@@ -0,0 +1,51 @@
1
+ export function localPoint(evt) {
2
+ const node = evt.target;
3
+ if (!node)
4
+ return null;
5
+ if (!(node instanceof SVGElement))
6
+ return null;
7
+ const svg = node instanceof SVGSVGElement ? node : node.ownerSVGElement;
8
+ if (!svg)
9
+ return null;
10
+ const screenCTM = svg.getScreenCTM();
11
+ if (!screenCTM)
12
+ return null;
13
+ const point = svg.createSVGPoint();
14
+ if ("changedTouches" in evt) {
15
+ point.x = evt.changedTouches[0].clientX;
16
+ point.y = evt.changedTouches[0].clientY;
17
+ }
18
+ else {
19
+ point.x = evt.clientX;
20
+ point.y = evt.clientY;
21
+ }
22
+ return point.matrixTransform(screenCTM.inverse());
23
+ }
24
+ const measureTextId = "__bms_measure_text_element";
25
+ export function measureSvgString(str, fontSize) {
26
+ try {
27
+ let txtElem = document.getElementById(measureTextId);
28
+ if (!txtElem) {
29
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
30
+ svg.setAttribute("aria-hidden", "true");
31
+ svg.style.position = "absolute";
32
+ svg.style.top = "-100%";
33
+ svg.style.left = "-100%";
34
+ svg.style.width = "0";
35
+ svg.style.height = "0";
36
+ svg.style.opacity = "0";
37
+ txtElem = document.createElementNS("http://www.w3.org/2000/svg", "text");
38
+ txtElem.setAttribute("id", measureTextId);
39
+ if (fontSize) {
40
+ txtElem.style.fontSize = fontSize.toString();
41
+ }
42
+ svg.appendChild(txtElem);
43
+ document.body.appendChild(svg);
44
+ }
45
+ txtElem.textContent = str;
46
+ return txtElem.getComputedTextLength();
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ }
@@ -0,0 +1,4 @@
1
+ import { Duration } from "date-fns";
2
+ export default function parseISODuration(argument: string): Duration | null;
3
+ export declare function durationToSeconds(duration: string): number;
4
+ export declare function durationToMinutes(duration: string): number;