@isothrum/editor 0.0.0-stage → 0.1.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 (293) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/PUBLISHING.md +93 -0
  4. package/README.md +106 -2
  5. package/desktop-editor/editor.css +11 -0
  6. package/desktop-editor/index.html +14 -0
  7. package/desktop-editor/main.tsx +26 -0
  8. package/dist/desktop/editor.css +1 -0
  9. package/dist/desktop/editor.js +181 -0
  10. package/dist/desktop/fonts/geist-cyrillic-ext-wght-normal-RO72NYA2.woff2 +0 -0
  11. package/dist/desktop/fonts/geist-cyrillic-wght-normal-CK2XY27K.woff2 +0 -0
  12. package/dist/desktop/fonts/geist-latin-ext-wght-normal-XEQ56JUF.woff2 +0 -0
  13. package/dist/desktop/fonts/geist-latin-wght-normal-T72VVCUW.woff2 +0 -0
  14. package/dist/desktop/fonts/geist-mono-cyrillic-ext-wght-normal-QXKVIKFD.woff2 +0 -0
  15. package/dist/desktop/fonts/geist-mono-cyrillic-wght-normal-GOIAQAGU.woff2 +0 -0
  16. package/dist/desktop/fonts/geist-mono-latin-ext-wght-normal-HU3ZAWN6.woff2 +0 -0
  17. package/dist/desktop/fonts/geist-mono-latin-wght-normal-CJNQKXUG.woff2 +0 -0
  18. package/dist/desktop/fonts/geist-mono-symbols2-wght-normal-WZJJVLQO.woff2 +0 -0
  19. package/dist/desktop/fonts/geist-mono-vietnamese-wght-normal-KW5NM6YV.woff2 +0 -0
  20. package/dist/desktop/fonts/geist-vietnamese-wght-normal-Y2R7JZKV.woff2 +0 -0
  21. package/dist/desktop/fonts/shantell-sans-cyrillic-ext-wght-normal-ILPQWRJJ.woff2 +0 -0
  22. package/dist/desktop/fonts/shantell-sans-cyrillic-wght-normal-RKC6NDPM.woff2 +0 -0
  23. package/dist/desktop/fonts/shantell-sans-latin-ext-wght-normal-SNKHG3LM.woff2 +0 -0
  24. package/dist/desktop/fonts/shantell-sans-latin-wght-normal-7CHHGC3N.woff2 +0 -0
  25. package/dist/desktop/fonts/shantell-sans-vietnamese-wght-normal-IPFAQSBA.woff2 +0 -0
  26. package/dist/desktop/index.html +14 -0
  27. package/dist/desktop/styles.css +2 -0
  28. package/dist/desktop/wasm/isothrum_wasm.d.ts +60 -0
  29. package/dist/desktop/wasm/isothrum_wasm.js +312 -0
  30. package/dist/desktop/wasm/isothrum_wasm_bg.wasm +0 -0
  31. package/dist/index.js +7059 -0
  32. package/dist/index.js.map +7 -0
  33. package/dist/model.js +745 -0
  34. package/dist/model.js.map +7 -0
  35. package/dist/types/components/tool/canvas/cable-edge.d.ts +4 -0
  36. package/dist/types/components/tool/canvas/contexts.d.ts +12 -0
  37. package/dist/types/components/tool/canvas/device-icon.d.ts +17 -0
  38. package/dist/types/components/tool/canvas/inline-text.d.ts +15 -0
  39. package/dist/types/components/tool/canvas/lan-node.d.ts +8 -0
  40. package/dist/types/components/tool/canvas/machine-addresses.d.ts +14 -0
  41. package/dist/types/components/tool/canvas/machine-node.d.ts +4 -0
  42. package/dist/types/components/tool/canvas/note-node.d.ts +7 -0
  43. package/dist/types/components/tool/canvas/port-led.d.ts +10 -0
  44. package/dist/types/components/tool/canvas/router-node.d.ts +8 -0
  45. package/dist/types/components/tool/canvas/sketch.d.ts +50 -0
  46. package/dist/types/components/tool/canvas/status-dot.d.ts +5 -0
  47. package/dist/types/components/tool/canvas/switch-node.d.ts +8 -0
  48. package/dist/types/components/tool/canvas/use-measured-ports.d.ts +7 -0
  49. package/dist/types/components/tool/context-menus.d.ts +5 -0
  50. package/dist/types/components/tool/device-block.d.ts +12 -0
  51. package/dist/types/components/tool/editor-menu.d.ts +28 -0
  52. package/dist/types/components/tool/export/copy-button.d.ts +9 -0
  53. package/dist/types/components/tool/export/export-panel.d.ts +17 -0
  54. package/dist/types/components/tool/export/target-list.d.ts +15 -0
  55. package/dist/types/components/tool/floating-window.d.ts +13 -0
  56. package/dist/types/components/tool/flow-canvas.d.ts +6 -0
  57. package/dist/types/components/tool/hooks/use-cabling.d.ts +23 -0
  58. package/dist/types/components/tool/hooks/use-captures.d.ts +9 -0
  59. package/dist/types/components/tool/hooks/use-clipboard.d.ts +12 -0
  60. package/dist/types/components/tool/hooks/use-context-menus.d.ts +25 -0
  61. package/dist/types/components/tool/hooks/use-design.d.ts +10 -0
  62. package/dist/types/components/tool/hooks/use-desktop.d.ts +50 -0
  63. package/dist/types/components/tool/hooks/use-devices.d.ts +17 -0
  64. package/dist/types/components/tool/hooks/use-downloads.d.ts +9 -0
  65. package/dist/types/components/tool/hooks/use-editor.d.ts +609 -0
  66. package/dist/types/components/tool/hooks/use-engine.d.ts +9 -0
  67. package/dist/types/components/tool/hooks/use-history.d.ts +9 -0
  68. package/dist/types/components/tool/hooks/use-lab-actions.d.ts +25 -0
  69. package/dist/types/components/tool/hooks/use-lab-run.d.ts +25 -0
  70. package/dist/types/components/tool/hooks/use-lab.d.ts +18 -0
  71. package/dist/types/components/tool/hooks/use-lan-carry.d.ts +8 -0
  72. package/dist/types/components/tool/hooks/use-machine-actions.d.ts +26 -0
  73. package/dist/types/components/tool/hooks/use-placement.d.ts +27 -0
  74. package/dist/types/components/tool/hooks/use-project.d.ts +25 -0
  75. package/dist/types/components/tool/hooks/use-projects.d.ts +34 -0
  76. package/dist/types/components/tool/hooks/use-shared-link.d.ts +23 -0
  77. package/dist/types/components/tool/hooks/use-toast.d.ts +2 -0
  78. package/dist/types/components/tool/hooks/use-tools.d.ts +17 -0
  79. package/dist/types/components/tool/lab-canvas.d.ts +18 -0
  80. package/dist/types/components/tool/overlays.d.ts +5 -0
  81. package/dist/types/components/tool/projects-list.d.ts +9 -0
  82. package/dist/types/components/tool/text.d.ts +418 -0
  83. package/dist/types/components/tool/toolbar.d.ts +5 -0
  84. package/dist/types/components/tool/top-bars.d.ts +10 -0
  85. package/dist/types/components/tool/windows/conditions-fields.d.ts +6 -0
  86. package/dist/types/components/tool/windows/editor-windows.d.ts +5 -0
  87. package/dist/types/components/tool/windows/fields.d.ts +4 -0
  88. package/dist/types/components/tool/windows/lab-status.d.ts +6 -0
  89. package/dist/types/components/tool/windows/lab-windows.d.ts +13 -0
  90. package/dist/types/components/tool/windows/link-controls.d.ts +21 -0
  91. package/dist/types/components/tool/windows/machine-controls.d.ts +16 -0
  92. package/dist/types/components/tool/windows/machine-inspector.d.ts +11 -0
  93. package/dist/types/components/tool/windows/runs-fields.d.ts +18 -0
  94. package/dist/types/components/tool/windows/selected-windows.d.ts +21 -0
  95. package/dist/types/components/ui/button.d.ts +8 -0
  96. package/dist/types/components/ui/dropdown-menu.d.ts +21 -0
  97. package/dist/types/index.d.ts +7 -0
  98. package/dist/types/lib/auth.d.ts +38 -0
  99. package/dist/types/lib/brand.d.ts +19 -0
  100. package/dist/types/lib/i18n.d.ts +19 -0
  101. package/dist/types/lib/tool/blocks.d.ts +35 -0
  102. package/dist/types/lib/tool/cables.d.ts +48 -0
  103. package/dist/types/lib/tool/clone.d.ts +12 -0
  104. package/dist/types/lib/tool/conditions.d.ts +31 -0
  105. package/dist/types/lib/tool/create.d.ts +22 -0
  106. package/dist/types/lib/tool/desktop.d.ts +63 -0
  107. package/dist/types/lib/tool/draft.d.ts +20 -0
  108. package/dist/types/lib/tool/engine.d.ts +33 -0
  109. package/dist/types/lib/tool/examples.d.ts +11 -0
  110. package/dist/types/lib/tool/export-targets.d.ts +21 -0
  111. package/dist/types/lib/tool/facing.d.ts +9 -0
  112. package/dist/types/lib/tool/geometry.d.ts +36 -0
  113. package/dist/types/lib/tool/gns3-cables.d.ts +17 -0
  114. package/dist/types/lib/tool/gns3-import.d.ts +15 -0
  115. package/dist/types/lib/tool/gns3-parts.d.ts +25 -0
  116. package/dist/types/lib/tool/issues.d.ts +12 -0
  117. package/dist/types/lib/tool/layout.d.ts +52 -0
  118. package/dist/types/lib/tool/live.d.ts +21 -0
  119. package/dist/types/lib/tool/logos.d.ts +7 -0
  120. package/dist/types/lib/tool/model.d.ts +173 -0
  121. package/dist/types/lib/tool/os.d.ts +20 -0
  122. package/dist/types/lib/tool/pins.d.ts +5 -0
  123. package/dist/types/lib/tool/placement.d.ts +21 -0
  124. package/dist/types/lib/tool/ports.d.ts +21 -0
  125. package/dist/types/lib/tool/presets.d.ts +21 -0
  126. package/dist/types/lib/tool/projects-api.d.ts +37 -0
  127. package/dist/types/lib/tool/router-ports.d.ts +22 -0
  128. package/dist/types/lib/tool/selection.d.ts +19 -0
  129. package/dist/types/lib/tool/storage.d.ts +25 -0
  130. package/dist/types/lib/tool/switch-edit.d.ts +17 -0
  131. package/dist/types/lib/tool/text/de.d.ts +2 -0
  132. package/dist/types/lib/tool/text/en.d.ts +429 -0
  133. package/dist/types/lib/tool/text/es.d.ts +2 -0
  134. package/dist/types/lib/tool/text/fr.d.ts +2 -0
  135. package/dist/types/lib/tool/text/index.d.ts +419 -0
  136. package/dist/types/lib/tool/topology.d.ts +2 -0
  137. package/dist/types/lib/tool/vlans.d.ts +24 -0
  138. package/dist/types/lib/utils.d.ts +2 -0
  139. package/dist/types/model.d.ts +13 -0
  140. package/package.json +88 -4
  141. package/scripts/build-desktop-editor.mjs +43 -0
  142. package/scripts/build-lib.mjs +38 -0
  143. package/src/components/tool/canvas/cable-edge.tsx +112 -0
  144. package/src/components/tool/canvas/contexts.ts +18 -0
  145. package/src/components/tool/canvas/device-icon.tsx +105 -0
  146. package/src/components/tool/canvas/inline-text.tsx +69 -0
  147. package/src/components/tool/canvas/lan-node.tsx +148 -0
  148. package/src/components/tool/canvas/machine-addresses.tsx +117 -0
  149. package/src/components/tool/canvas/machine-node.tsx +114 -0
  150. package/src/components/tool/canvas/note-node.tsx +109 -0
  151. package/src/components/tool/canvas/port-led.tsx +21 -0
  152. package/src/components/tool/canvas/router-node.tsx +114 -0
  153. package/src/components/tool/canvas/sketch.tsx +130 -0
  154. package/src/components/tool/canvas/status-dot.tsx +29 -0
  155. package/src/components/tool/canvas/switch-node.tsx +143 -0
  156. package/src/components/tool/canvas/use-measured-ports.ts +25 -0
  157. package/src/components/tool/context-menus.tsx +142 -0
  158. package/src/components/tool/device-block.tsx +107 -0
  159. package/src/components/tool/editor-menu.tsx +191 -0
  160. package/src/components/tool/export/copy-button.tsx +45 -0
  161. package/src/components/tool/export/export-panel.tsx +127 -0
  162. package/src/components/tool/export/target-list.tsx +87 -0
  163. package/src/components/tool/floating-window.tsx +69 -0
  164. package/src/components/tool/flow-canvas.tsx +138 -0
  165. package/src/components/tool/hooks/use-cabling.ts +66 -0
  166. package/src/components/tool/hooks/use-captures.ts +24 -0
  167. package/src/components/tool/hooks/use-clipboard.ts +54 -0
  168. package/src/components/tool/hooks/use-context-menus.ts +37 -0
  169. package/src/components/tool/hooks/use-design.ts +24 -0
  170. package/src/components/tool/hooks/use-desktop.ts +100 -0
  171. package/src/components/tool/hooks/use-devices.ts +58 -0
  172. package/src/components/tool/hooks/use-downloads.ts +42 -0
  173. package/src/components/tool/hooks/use-editor.ts +114 -0
  174. package/src/components/tool/hooks/use-engine.ts +29 -0
  175. package/src/components/tool/hooks/use-history.ts +107 -0
  176. package/src/components/tool/hooks/use-lab-actions.ts +57 -0
  177. package/src/components/tool/hooks/use-lab-run.ts +61 -0
  178. package/src/components/tool/hooks/use-lab.ts +32 -0
  179. package/src/components/tool/hooks/use-lan-carry.ts +43 -0
  180. package/src/components/tool/hooks/use-machine-actions.ts +57 -0
  181. package/src/components/tool/hooks/use-placement.ts +80 -0
  182. package/src/components/tool/hooks/use-project.ts +112 -0
  183. package/src/components/tool/hooks/use-projects.ts +85 -0
  184. package/src/components/tool/hooks/use-shared-link.ts +64 -0
  185. package/src/components/tool/hooks/use-toast.ts +16 -0
  186. package/src/components/tool/hooks/use-tools.ts +60 -0
  187. package/src/components/tool/lab-canvas.tsx +96 -0
  188. package/src/components/tool/overlays.tsx +104 -0
  189. package/src/components/tool/projects-list.tsx +96 -0
  190. package/src/components/tool/text.ts +9 -0
  191. package/src/components/tool/toolbar.tsx +106 -0
  192. package/src/components/tool/top-bars.tsx +90 -0
  193. package/src/components/tool/windows/conditions-fields.tsx +43 -0
  194. package/src/components/tool/windows/editor-windows.tsx +73 -0
  195. package/src/components/tool/windows/fields.ts +6 -0
  196. package/src/components/tool/windows/lab-status.tsx +68 -0
  197. package/src/components/tool/windows/lab-windows.tsx +130 -0
  198. package/src/components/tool/windows/link-controls.tsx +69 -0
  199. package/src/components/tool/windows/machine-controls.tsx +116 -0
  200. package/src/components/tool/windows/machine-inspector.tsx +83 -0
  201. package/src/components/tool/windows/runs-fields.tsx +127 -0
  202. package/src/components/tool/windows/selected-windows.tsx +147 -0
  203. package/src/components/ui/button.tsx +59 -0
  204. package/src/components/ui/dropdown-menu.tsx +185 -0
  205. package/src/index.ts +21 -0
  206. package/src/lib/auth.tsx +43 -0
  207. package/src/lib/brand.tsx +46 -0
  208. package/src/lib/i18n.ts +53 -0
  209. package/src/lib/tool/blocks.test.ts +64 -0
  210. package/src/lib/tool/blocks.ts +78 -0
  211. package/src/lib/tool/cable-wiring.test.ts +74 -0
  212. package/src/lib/tool/cables.test.ts +75 -0
  213. package/src/lib/tool/cables.ts +215 -0
  214. package/src/lib/tool/clone.test.ts +54 -0
  215. package/src/lib/tool/clone.ts +48 -0
  216. package/src/lib/tool/conditions.test.ts +170 -0
  217. package/src/lib/tool/conditions.ts +132 -0
  218. package/src/lib/tool/create.test.ts +67 -0
  219. package/src/lib/tool/create.ts +83 -0
  220. package/src/lib/tool/desktop.test.ts +59 -0
  221. package/src/lib/tool/desktop.ts +99 -0
  222. package/src/lib/tool/draft.test.ts +150 -0
  223. package/src/lib/tool/draft.ts +109 -0
  224. package/src/lib/tool/engine.test.ts +39 -0
  225. package/src/lib/tool/engine.ts +58 -0
  226. package/src/lib/tool/examples.test.ts +35 -0
  227. package/src/lib/tool/examples.ts +71 -0
  228. package/src/lib/tool/export-targets.test.ts +47 -0
  229. package/src/lib/tool/export-targets.ts +84 -0
  230. package/src/lib/tool/facing.test.ts +72 -0
  231. package/src/lib/tool/facing.ts +100 -0
  232. package/src/lib/tool/geometry.test.ts +80 -0
  233. package/src/lib/tool/geometry.ts +109 -0
  234. package/src/lib/tool/gns3-cables.test.ts +47 -0
  235. package/src/lib/tool/gns3-cables.ts +81 -0
  236. package/src/lib/tool/gns3-import.test.ts +102 -0
  237. package/src/lib/tool/gns3-import.ts +198 -0
  238. package/src/lib/tool/gns3-layout.test.ts +62 -0
  239. package/src/lib/tool/gns3-parts.test.ts +47 -0
  240. package/src/lib/tool/gns3-parts.ts +68 -0
  241. package/src/lib/tool/issues.test.ts +35 -0
  242. package/src/lib/tool/issues.ts +60 -0
  243. package/src/lib/tool/layout.test.ts +128 -0
  244. package/src/lib/tool/layout.ts +229 -0
  245. package/src/lib/tool/live.test.ts +46 -0
  246. package/src/lib/tool/live.ts +49 -0
  247. package/src/lib/tool/logos.test.ts +30 -0
  248. package/src/lib/tool/logos.ts +99 -0
  249. package/src/lib/tool/model.test.ts +128 -0
  250. package/src/lib/tool/model.ts +238 -0
  251. package/src/lib/tool/os.test.ts +45 -0
  252. package/src/lib/tool/os.ts +57 -0
  253. package/src/lib/tool/parity.test.ts +145 -0
  254. package/src/lib/tool/pins.test.ts +24 -0
  255. package/src/lib/tool/pins.ts +11 -0
  256. package/src/lib/tool/placement.test.ts +79 -0
  257. package/src/lib/tool/placement.ts +60 -0
  258. package/src/lib/tool/ports.test.ts +39 -0
  259. package/src/lib/tool/ports.ts +48 -0
  260. package/src/lib/tool/presets.test.ts +50 -0
  261. package/src/lib/tool/presets.ts +77 -0
  262. package/src/lib/tool/projects-api.test.ts +59 -0
  263. package/src/lib/tool/projects-api.ts +47 -0
  264. package/src/lib/tool/router-ports.test.ts +63 -0
  265. package/src/lib/tool/router-ports.ts +88 -0
  266. package/src/lib/tool/selection.test.ts +44 -0
  267. package/src/lib/tool/selection.ts +34 -0
  268. package/src/lib/tool/storage.test.ts +123 -0
  269. package/src/lib/tool/storage.ts +127 -0
  270. package/src/lib/tool/switch-edit.test.ts +49 -0
  271. package/src/lib/tool/switch-edit.ts +38 -0
  272. package/src/lib/tool/text/de.ts +358 -0
  273. package/src/lib/tool/text/en.ts +371 -0
  274. package/src/lib/tool/text/es.ts +358 -0
  275. package/src/lib/tool/text/fr.ts +358 -0
  276. package/src/lib/tool/text/index.ts +21 -0
  277. package/src/lib/tool/text/text.test.ts +33 -0
  278. package/src/lib/tool/topology.test.ts +108 -0
  279. package/src/lib/tool/topology.ts +116 -0
  280. package/src/lib/tool/vlans.test.ts +64 -0
  281. package/src/lib/tool/vlans.ts +79 -0
  282. package/src/lib/utils.ts +6 -0
  283. package/src/model.ts +13 -0
  284. package/src/test/arbitrary.ts +41 -0
  285. package/src/test/engine.ts +48 -0
  286. package/src/test/lab.ts +101 -0
  287. package/styles/globals.css +258 -0
  288. package/styles/theme.css +192 -0
  289. package/tsconfig.build.json +12 -0
  290. package/tsconfig.json +22 -0
  291. package/wasm/isothrum_wasm.d.ts +60 -0
  292. package/wasm/isothrum_wasm.js +312 -0
  293. package/wasm/isothrum_wasm_bg.wasm +0 -0
@@ -0,0 +1,609 @@
1
+ import { type RefObject } from "react";
2
+ import { type CableEdge, type LabNode } from "../../../lib/tool/model.js";
3
+ import type { Plan } from "../../../lib/tool/engine.js";
4
+ /** The lab editor's state and behaviour: what the canvas, the toolbar and the windows show and do. */
5
+ export declare function useEditor(lang: string, accounts: boolean, canvasRef: RefObject<HTMLDivElement | null>): {
6
+ lang: string;
7
+ accounts: boolean;
8
+ t: {
9
+ toolbar: {
10
+ blocks: {
11
+ switch: string;
12
+ router: string;
13
+ firewall: string;
14
+ container: string;
15
+ vm: string;
16
+ mine: string;
17
+ };
18
+ kindsOf: (block: string) => string;
19
+ devices: string;
20
+ hand: string;
21
+ select: string;
22
+ lan: string;
23
+ lanTitle: string;
24
+ switch: string;
25
+ switchTitle: string;
26
+ note: string;
27
+ noteTitle: string;
28
+ forget: (device: string) => string;
29
+ forgetLabel: (device: string) => string;
30
+ undo: string;
31
+ undoTitle: string;
32
+ redo: string;
33
+ redoTitle: string;
34
+ };
35
+ hints: {
36
+ lan: string;
37
+ note: string;
38
+ place: (device: string) => string;
39
+ hand: string;
40
+ cable: string;
41
+ select: string;
42
+ };
43
+ devices: {
44
+ router: {
45
+ label: string;
46
+ hint: string;
47
+ };
48
+ "router-frr": {
49
+ label: string;
50
+ hint: string;
51
+ };
52
+ firewall: {
53
+ label: string;
54
+ hint: string;
55
+ };
56
+ container: {
57
+ label: string;
58
+ };
59
+ web: {
60
+ label: string;
61
+ hint: string;
62
+ };
63
+ database: {
64
+ label: string;
65
+ hint: string;
66
+ };
67
+ desktop: {
68
+ label: string;
69
+ hint: string;
70
+ };
71
+ "linux-vm": {
72
+ label: string;
73
+ };
74
+ "ubuntu-vm": {
75
+ label: string;
76
+ };
77
+ "kali-vm": {
78
+ label: string;
79
+ };
80
+ "windows-vm": {
81
+ label: string;
82
+ };
83
+ workstation: {
84
+ label: string;
85
+ hint: string;
86
+ };
87
+ "cisco-iol": {
88
+ label: string;
89
+ hint: string;
90
+ };
91
+ "cisco-iol-l2": {
92
+ label: string;
93
+ hint: string;
94
+ };
95
+ };
96
+ myDevice: (what: string) => string;
97
+ myDeviceRouter: string;
98
+ status: {
99
+ loading: string;
100
+ toFix: (count: number) => string;
101
+ valid: string;
102
+ };
103
+ run: {
104
+ autoStart: string;
105
+ autoStartNote: string;
106
+ statusTitle: (up: number, total: number) => string;
107
+ probed: string;
108
+ inferred: string;
109
+ run: string;
110
+ starting: string;
111
+ stop: string;
112
+ stopping: string;
113
+ vmsTitle: string;
114
+ runVmsTitle: string;
115
+ startingVmsLog: string;
116
+ runTitle: string;
117
+ startingLog: string;
118
+ window: string;
119
+ running: string;
120
+ stopped: string;
121
+ noDocker: string;
122
+ noLiveCapture: (wireshark: boolean, dir: string) => string;
123
+ };
124
+ capture: {
125
+ capturing: (network: string) => string;
126
+ writingTo: string;
127
+ live: string;
128
+ stop: string;
129
+ start: string;
130
+ runFirst: string;
131
+ };
132
+ link: {
133
+ suspend: string;
134
+ resume: string;
135
+ suspendAll: string;
136
+ resumeAll: string;
137
+ cableSuspended: string;
138
+ lanSuspended: (ports: number) => string;
139
+ runFirst: string;
140
+ };
141
+ export: string;
142
+ engineDidntLoad: (error: string) => string;
143
+ engineFailed: (error: string) => string;
144
+ toasts: {
145
+ brokenLink: string;
146
+ openedShared: (lab: string) => string;
147
+ linkCopied: string;
148
+ copyPrompt: string;
149
+ savedDevice: (device: string) => string;
150
+ gns3Opened: (lab: string, machines: number, lans: number) => string;
151
+ undoBringsBack: string;
152
+ gns3Unreadable: string;
153
+ };
154
+ windows: {
155
+ machine: string;
156
+ lan: (lan: string) => string;
157
+ cable: (a: string, b: string) => string;
158
+ portOn: (machine: string) => string;
159
+ cableNote: string;
160
+ removeCable: string;
161
+ conditions: {
162
+ title: string;
163
+ delay: string;
164
+ jitter: string;
165
+ loss: string;
166
+ rate: string;
167
+ hint: string;
168
+ onLan: string;
169
+ onVlan: string;
170
+ };
171
+ selected: (count: number) => string;
172
+ selection: (items: number, cables: number) => string;
173
+ deleteSelection: (count: number) => string;
174
+ close: string;
175
+ };
176
+ lab: {
177
+ title: string;
178
+ containers: string;
179
+ vms: string;
180
+ lans: string;
181
+ cables: string;
182
+ toFix: string;
183
+ valid: string;
184
+ routing: string;
185
+ };
186
+ menu: {
187
+ menu: string;
188
+ example: string;
189
+ vlanExample: string;
190
+ gns3: string;
191
+ gns3File: string;
192
+ share: string;
193
+ fit: string;
194
+ clear: string;
195
+ light: string;
196
+ dark: string;
197
+ style: string;
198
+ styles: {
199
+ sketch: string;
200
+ business: string;
201
+ };
202
+ language: string;
203
+ about: string;
204
+ blog: string;
205
+ };
206
+ welcome: {
207
+ menuHint: string;
208
+ toolbarHint: string;
209
+ pitch: string;
210
+ example: string;
211
+ how: string;
212
+ };
213
+ inspector: {
214
+ name: string;
215
+ runsAs: string;
216
+ automaticRouter: string;
217
+ container: string;
218
+ vm: string;
219
+ routerNote: string;
220
+ image: string;
221
+ keepRunning: string;
222
+ applianceNote: string;
223
+ ciscoOs: string;
224
+ needsKvm: string;
225
+ dynamipsFirmware: (name: string) => string;
226
+ iosConfig: string;
227
+ iosConfigHint: string;
228
+ keepRunningHint: string;
229
+ os: string;
230
+ provision: string;
231
+ ports: string;
232
+ access: string;
233
+ cables: string;
234
+ noCables: string;
235
+ saveTitle: string;
236
+ save: string;
237
+ remove: string;
238
+ };
239
+ canvas: {
240
+ imageShort: string;
241
+ hosts: (n: number) => string;
242
+ roles: {
243
+ router: string;
244
+ firewall: string;
245
+ workstation: string;
246
+ server: string;
247
+ desktop: string;
248
+ host: string;
249
+ };
250
+ switchModel: (ports: number) => string;
251
+ live: {
252
+ up: string;
253
+ starting: string;
254
+ unhealthy: string;
255
+ down: string;
256
+ portUp: string;
257
+ portDown: string;
258
+ portUnknown: string;
259
+ lanPorts: (up: number, total: number) => string;
260
+ cable: {
261
+ up: string;
262
+ cut: string;
263
+ down: string;
264
+ };
265
+ cableShort: {
266
+ cut: string;
267
+ down: string;
268
+ };
269
+ };
270
+ editTitle: (what: string) => string;
271
+ unnamed: string;
272
+ machineName: string;
273
+ vm: string;
274
+ automatic: string;
275
+ container: string;
276
+ access: string;
277
+ addressTitle: (network: string, fixed: boolean) => string;
278
+ fixed: string;
279
+ addressOn: (network: string) => string;
280
+ lanName: string;
281
+ addressBlock: string;
282
+ internetOnTitle: string;
283
+ internetOffTitle: string;
284
+ internetOn: string;
285
+ internetOff: string;
286
+ showAreaTitle: string;
287
+ hideAreaTitle: string;
288
+ showArea: string;
289
+ hideArea: string;
290
+ switchName: string;
291
+ port: (n: number) => string;
292
+ trunkPort: string;
293
+ trunkCarries: (vlans: string) => string;
294
+ noVlan: string;
295
+ clickToChange: string;
296
+ vlanNumber: string;
297
+ vlanBlock: string;
298
+ remove: (what: string) => string;
299
+ routerName: string;
300
+ portFree: (port: string) => string;
301
+ textOnly: string;
302
+ box: string;
303
+ ellipse: string;
304
+ colors: {
305
+ yellow: string;
306
+ red: string;
307
+ blue: string;
308
+ green: string;
309
+ violet: string;
310
+ };
311
+ color: (color: string) => string;
312
+ write: string;
313
+ note: string;
314
+ noteName: string;
315
+ };
316
+ exportPanel: {
317
+ copy: string;
318
+ copied: string;
319
+ labName: string;
320
+ fixFirst: string;
321
+ download: (lab: string) => string;
322
+ onlySpec: string;
323
+ where: string;
324
+ whereIntro: string;
325
+ mixed: string;
326
+ install: string;
327
+ files: (count: number) => string;
328
+ downloadOnly: (target: string) => string;
329
+ downloadTarget: (target: string) => string;
330
+ withIsoloom: string;
331
+ withTool: string;
332
+ run: string;
333
+ specIntro: string;
334
+ showSpec: string;
335
+ hideSpec: string;
336
+ containersAndVms: string;
337
+ dockerOnOneVm: string;
338
+ oneVmPerMachine: string;
339
+ };
340
+ issues: {
341
+ vlanBlocks: (vlan: string, block: string, other: string, sw: string) => string;
342
+ areaBlock: (lan: string, block: string, switches: string) => string;
343
+ noName: {
344
+ machine: string;
345
+ lan: string;
346
+ switch: string;
347
+ };
348
+ sameName: {
349
+ machine: (name: string) => string;
350
+ lan: (name: string) => string;
351
+ switch: (name: string) => string;
352
+ };
353
+ badPort: (machine: string, entry: string) => string;
354
+ };
355
+ gns3: {
356
+ notGns3: string;
357
+ noTopology: string;
358
+ cisco: (node: string, kind: string) => string;
359
+ firewall: (node: string) => string;
360
+ noEquivalent: (node: string, type: string) => string;
361
+ noNodes: string;
362
+ };
363
+ account: {
364
+ signIn: string;
365
+ signOut: string;
366
+ signedInAs: (name: string) => string;
367
+ };
368
+ projects: {
369
+ save: string;
370
+ saveAs: string;
371
+ openList: string;
372
+ saveAsPrompt: string;
373
+ windowTitle: string;
374
+ loading: string;
375
+ none: string;
376
+ open: string;
377
+ openButton: string;
378
+ delete: (name: string) => string;
379
+ confirmDelete: (name: string) => string;
380
+ failed: (error: string) => string;
381
+ history: (name: string) => string;
382
+ noVersions: string;
383
+ restore: string;
384
+ historyHint: string;
385
+ opened: (name: string) => string;
386
+ status: {
387
+ idle: (name: string) => string;
388
+ saving: (name: string) => string;
389
+ saved: (name: string) => string;
390
+ error: (name: string) => string;
391
+ };
392
+ };
393
+ machineRun: {
394
+ display: string;
395
+ displayTitle: string;
396
+ displayOpened: (what: string) => string;
397
+ consoleHint: string;
398
+ runFirst: string;
399
+ running: string;
400
+ stopped: string;
401
+ unknown: string;
402
+ console: string;
403
+ restart: string;
404
+ stop: string;
405
+ start: string;
406
+ snapshots: string;
407
+ takeSnapshot: string;
408
+ snapshotHint: string;
409
+ snapshotPrompt: string;
410
+ noSnapshots: string;
411
+ restore: string;
412
+ inUse: string;
413
+ ownImage: string;
414
+ deleteSnapshot: (label: string) => string;
415
+ };
416
+ update: {
417
+ available: (version: string) => string;
418
+ restart: string;
419
+ installing: string;
420
+ later: string;
421
+ };
422
+ };
423
+ engine: import("../../../lib/tool/engine.js").Engine | null;
424
+ engineError: string | null;
425
+ plan: Plan | null;
426
+ resolvedTheme: string | undefined;
427
+ flow: import("@xyflow/react").ReactFlowInstance<LabNode, CableEdge>;
428
+ lab: {
429
+ initial: import("../../../lib/tool/model.js").Draft;
430
+ labName: string;
431
+ setLabName: import("react").Dispatch<import("react").SetStateAction<string>>;
432
+ nodes: LabNode[];
433
+ setNodes: import("react").Dispatch<import("react").SetStateAction<LabNode[]>>;
434
+ onNodesChange: import("@xyflow/react").OnNodesChange<LabNode>;
435
+ edges: CableEdge[];
436
+ setEdges: import("react").Dispatch<import("react").SetStateAction<CableEdge[]>>;
437
+ onEdgesChange: import("@xyflow/react").OnEdgesChange<CableEdge>;
438
+ };
439
+ tools: {
440
+ activeTool: string | null;
441
+ setActiveTool: import("react").Dispatch<import("react").SetStateAction<string | null>>;
442
+ mode: import("./use-tools").Mode;
443
+ setMode: import("react").Dispatch<import("react").SetStateAction<import("./use-tools").Mode>>;
444
+ pick: (tool: string) => void;
445
+ setModeOnly: (m: import("./use-tools").Mode) => void;
446
+ };
447
+ toast: string | null;
448
+ setToast: (message: string | null) => void;
449
+ desk: {
450
+ state: {
451
+ invoke: import("../../../lib/tool/desktop.js").Invoke | null;
452
+ info: import("../../../lib/tool/desktop.js").DesktopInfo | null;
453
+ setInfo: import("react").Dispatch<import("react").SetStateAction<import("../../../lib/tool/desktop.js").DesktopInfo | null>>;
454
+ run: import("./use-desktop").RunState;
455
+ setRun: import("react").Dispatch<import("react").SetStateAction<import("./use-desktop").RunState>>;
456
+ update: string | null;
457
+ setUpdate: import("react").Dispatch<import("react").SetStateAction<string | null>>;
458
+ updating: boolean;
459
+ setUpdating: import("react").Dispatch<import("react").SetStateAction<boolean>>;
460
+ };
461
+ live: {
462
+ machineStates: Record<string, string>;
463
+ snapshots: import("../../../lib/tool/desktop.js").Snapshot[];
464
+ links: import("../../../lib/tool/desktop.js").SuspendedLink[];
465
+ setLinks: import("react").Dispatch<import("react").SetStateAction<import("../../../lib/tool/desktop.js").SuspendedLink[]>>;
466
+ live: import("../../../lib/tool/desktop.js").LabLive | null;
467
+ setLive: import("react").Dispatch<import("react").SetStateAction<import("../../../lib/tool/desktop.js").LabLive | null>>;
468
+ refreshStates: () => Promise<void>;
469
+ };
470
+ actions: {
471
+ busy: boolean;
472
+ snapshotDo: (command: string, args: Record<string, unknown>) => Promise<void>;
473
+ machineAct: (machine: string, action: import("./use-machine-actions").MachineAction) => Promise<void>;
474
+ linkAct: (network: string, machines: string[] | undefined, action: import("./use-machine-actions").LinkAction) => Promise<void>;
475
+ machineConsole: (machine: string) => Promise<void>;
476
+ machineDisplay: (machine: string) => Promise<void>;
477
+ };
478
+ menus: {
479
+ machineMenu: import("./use-context-menus").MachineMenuAt | null;
480
+ setMachineMenu: import("react").Dispatch<import("react").SetStateAction<import("./use-context-menus").MachineMenuAt | null>>;
481
+ linkMenu: import("./use-context-menus").LinkMenuAt | null;
482
+ setLinkMenu: import("react").Dispatch<import("react").SetStateAction<import("./use-context-menus").LinkMenuAt | null>>;
483
+ closeMenus: () => void;
484
+ };
485
+ panel: {
486
+ runOpen: boolean;
487
+ setRunOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
488
+ runLog: string;
489
+ setRunLog: import("react").Dispatch<import("react").SetStateAction<string>>;
490
+ };
491
+ autoStart: {
492
+ autoStart: boolean;
493
+ setAutoStart: import("react").Dispatch<import("react").SetStateAction<boolean>>;
494
+ autoStartPending: boolean;
495
+ setAutoStartPending: import("react").Dispatch<import("react").SetStateAction<boolean>>;
496
+ };
497
+ captures: {
498
+ captures: Record<string, string | null>;
499
+ capture: (network: string) => Promise<void>;
500
+ stopCapture: (network: string) => Promise<void>;
501
+ clearCaptures: () => void;
502
+ };
503
+ };
504
+ history: {
505
+ step: (back: boolean) => void;
506
+ canUndo: boolean;
507
+ canRedo: boolean;
508
+ };
509
+ design: {
510
+ design: import("../../../lib/tool/model.js").Design;
511
+ setDesign: import("react").Dispatch<import("react").SetStateAction<import("../../../lib/tool/model.js").Design>>;
512
+ chooseDesign: (d: import("../../../lib/tool/model.js").Design) => void;
513
+ };
514
+ projects: {
515
+ signedIn: boolean;
516
+ setSignedInNow: import("react").Dispatch<import("react").SetStateAction<boolean>>;
517
+ proj: {
518
+ project: import("../../../lib/tool/storage").ProjectRef | null;
519
+ state: import("./use-project").SaveState;
520
+ save: (asNew?: boolean, name?: string) => Promise<import("../../../lib/tool/storage").ProjectRef | null>;
521
+ detach: () => void;
522
+ opened: (p: import("../../../lib/tool/storage").ProjectRef, d: import("../../../lib/tool/model.js").Draft) => void;
523
+ };
524
+ projectsOpen: boolean;
525
+ setProjectsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
526
+ openDraft: (d: import("../../../lib/tool/model.js").Draft) => void;
527
+ openProject: (p: import("../../../lib/tool/storage").ProjectRef, d: import("../../../lib/tool/model.js").Draft) => void;
528
+ saveAs: () => Promise<void>;
529
+ };
530
+ addresses: Partial<Record<string, [string, string][]>>;
531
+ index: import("../../../lib/tool/cables").LabIndex & {
532
+ lans: import("../../../lib/tool/model.js").LanNode[];
533
+ };
534
+ views: {
535
+ sides: Record<string, import("../../../lib/tool/model.js").Side>;
536
+ shownEdges: CableEdge[];
537
+ routerPorts: Record<string, import("../../../lib/tool/router-ports.js").RouterPorts>;
538
+ };
539
+ carry: {
540
+ onNodeDragStart: (_: unknown, node: LabNode) => void;
541
+ onNodeDrag: (_: unknown, node: LabNode) => void;
542
+ onNodeDragStop: () => void;
543
+ };
544
+ cabling: {
545
+ onNodesChange: (changes: import("@xyflow/system").NodeChange<LabNode>[]) => void;
546
+ isValid: (c: Parameters<typeof import("../../../lib/tool/cables").canConnect>[0]) => boolean;
547
+ onConnect: (c: import("@xyflow/system").Connection) => void;
548
+ onReconnect: (old: CableEdge, c: import("@xyflow/system").Connection) => void;
549
+ onReconnectStart: (_: unknown, edge: CableEdge) => void;
550
+ onReconnectEnd: () => void;
551
+ };
552
+ devices: {
553
+ presets: import("../../../lib/tool/presets").Preset[];
554
+ blocks: import("../../../lib/tool/blocks.js").Block[];
555
+ blockChoice: Record<string, string>;
556
+ pickFromBlock: (block: string, tool: string) => void;
557
+ saveDevice: (m: import("../../../lib/tool/model.js").MachineData) => void;
558
+ forgetDevice: (id: string) => void;
559
+ };
560
+ actions: {
561
+ updateMachine: (id: string, patch: Partial<import("../../../lib/tool/model.js").MachineData>) => void;
562
+ updateCable: (id: string, patch: Partial<import("../../../lib/tool/model.js").CableData>) => void;
563
+ loadExample: (make?: () => import("../../../lib/tool/model.js").Draft) => void;
564
+ clearLab: () => void;
565
+ importGns3: (file: File) => Promise<void>;
566
+ };
567
+ run: {
568
+ runLab: () => Promise<void>;
569
+ stopLab: () => Promise<void>;
570
+ };
571
+ liveView: import("../../../lib/tool/live.js").LiveView | null;
572
+ placement: {
573
+ onPaneClick: (e: import("react").MouseEvent) => void;
574
+ onNodeClick: (e: import("react").MouseEvent, node: LabNode) => void;
575
+ onDrop: (e: import("react").DragEvent) => void;
576
+ };
577
+ downloads: {
578
+ downloadError: string | null;
579
+ downloadAll: () => void;
580
+ downloadTarget: (dir: string) => void;
581
+ downloadSpec: () => void;
582
+ };
583
+ tool: {
584
+ label: string;
585
+ } | undefined;
586
+ issues: string[];
587
+ selection: {
588
+ selectedNodes: LabNode[];
589
+ selectedEdges: CableEdge[];
590
+ count: number;
591
+ machine: import("../../../lib/tool/model.js").MachineNode | undefined;
592
+ lan: import("../../../lib/tool/model.js").LanNode | undefined;
593
+ edge: CableEdge | undefined;
594
+ };
595
+ invoke: import("../../../lib/tool/desktop.js").Invoke | null;
596
+ exportOpen: boolean;
597
+ setExportOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
598
+ statusOpen: boolean;
599
+ setStatusOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
600
+ machines: import("../../../lib/tool/model.js").MachineNode[];
601
+ hasVms: boolean;
602
+ mixed: boolean;
603
+ empty: boolean;
604
+ fitWhenDrawn: (options?: {
605
+ padding: number;
606
+ maxZoom: number;
607
+ }) => void;
608
+ };
609
+ export type EditorModel = ReturnType<typeof useEditor>;
@@ -0,0 +1,9 @@
1
+ import { type Engine, type Plan } from "../../../lib/tool/engine.js";
2
+ import type { EditorText } from "../../../lib/tool/text/index.js";
3
+ /** The engine, once loaded (or why it didn't load). */
4
+ export declare function useEngine(): {
5
+ engine: Engine | null;
6
+ error: string | null;
7
+ };
8
+ /** The engine's plan for the lab (null until the engine has loaded). An engine crash must not take the canvas down with it. */
9
+ export declare function usePlan(engine: Engine | null, topology: string, t: EditorText): Plan | null;
@@ -0,0 +1,9 @@
1
+ import type { Lab } from "./use-lab";
2
+ /** Undo and redo. Every change to the lab goes into the history. */
3
+ export declare function useHistory(lab: Lab): {
4
+ step: (back: boolean) => void;
5
+ canUndo: boolean;
6
+ canRedo: boolean;
7
+ };
8
+ /** Whether a key event happens in a text field (where the keys edit the text, as everywhere else). */
9
+ export declare function inTextField(e: KeyboardEvent): boolean;
@@ -0,0 +1,25 @@
1
+ import { type CableData, type Draft, type MachineData } from "../../../lib/tool/model.js";
2
+ import type { EditorText } from "../../../lib/tool/text/index.js";
3
+ import { type Lab } from "./use-lab";
4
+ type FitView = (options: {
5
+ padding: number;
6
+ maxZoom: number;
7
+ }) => unknown;
8
+ /** After replacing the whole lab: fits once React Flow has measured the new nodes. */
9
+ export declare function useFitWhenDrawn(fitView: FitView): (options?: {
10
+ padding: number;
11
+ maxZoom: number;
12
+ }) => void;
13
+ /** Editing the lab from its windows and menus: a machine's or a cable's fields, examples, a GNS3 project. */
14
+ export declare function useLabActions(lab: Lab, fitWhenDrawn: (options?: {
15
+ padding: number;
16
+ maxZoom: number;
17
+ }) => void, setToast: (message: string) => void, t: EditorText): {
18
+ updateMachine: (id: string, patch: Partial<MachineData>) => void;
19
+ updateCable: (id: string, patch: Partial<CableData>) => void;
20
+ loadExample: (make?: () => Draft) => void;
21
+ clearLab: () => void;
22
+ /** A GNS3 project opens as a lab (Undo brings back the one that was there). */
23
+ importGns3: (file: File) => Promise<void>;
24
+ };
25
+ export {};
@@ -0,0 +1,25 @@
1
+ import { type Engine, type Plan } from "../../../lib/tool/engine.js";
2
+ import type { EditorText } from "../../../lib/tool/text/index.js";
3
+ import type { DesktopState, LiveLab, useAutoStart, useRunPanel } from "./use-desktop";
4
+ import type { Captures } from "./use-captures";
5
+ interface Deps {
6
+ state: DesktopState;
7
+ panel: ReturnType<typeof useRunPanel>;
8
+ autoStart: ReturnType<typeof useAutoStart>;
9
+ live: LiveLab;
10
+ captures: Captures;
11
+ lab: {
12
+ labName: string;
13
+ topology: string;
14
+ plan: Plan | null;
15
+ engine: Engine | null;
16
+ hasVms: boolean;
17
+ };
18
+ t: EditorText;
19
+ }
20
+ /** Running the lab on this machine (desktop): `lab_up` from the engine's spec, and `lab_down`. */
21
+ export declare function useLabRun({ state, panel, autoStart, live, captures, lab, t }: Deps): {
22
+ runLab: () => Promise<void>;
23
+ stopLab: () => Promise<void>;
24
+ };
25
+ export {};