@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.
- package/LICENSE +202 -0
- package/NOTICE +8 -0
- package/PUBLISHING.md +93 -0
- package/README.md +106 -2
- package/desktop-editor/editor.css +11 -0
- package/desktop-editor/index.html +14 -0
- package/desktop-editor/main.tsx +26 -0
- package/dist/desktop/editor.css +1 -0
- package/dist/desktop/editor.js +181 -0
- package/dist/desktop/fonts/geist-cyrillic-ext-wght-normal-RO72NYA2.woff2 +0 -0
- package/dist/desktop/fonts/geist-cyrillic-wght-normal-CK2XY27K.woff2 +0 -0
- package/dist/desktop/fonts/geist-latin-ext-wght-normal-XEQ56JUF.woff2 +0 -0
- package/dist/desktop/fonts/geist-latin-wght-normal-T72VVCUW.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-cyrillic-ext-wght-normal-QXKVIKFD.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-cyrillic-wght-normal-GOIAQAGU.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-latin-ext-wght-normal-HU3ZAWN6.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-latin-wght-normal-CJNQKXUG.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-symbols2-wght-normal-WZJJVLQO.woff2 +0 -0
- package/dist/desktop/fonts/geist-mono-vietnamese-wght-normal-KW5NM6YV.woff2 +0 -0
- package/dist/desktop/fonts/geist-vietnamese-wght-normal-Y2R7JZKV.woff2 +0 -0
- package/dist/desktop/fonts/shantell-sans-cyrillic-ext-wght-normal-ILPQWRJJ.woff2 +0 -0
- package/dist/desktop/fonts/shantell-sans-cyrillic-wght-normal-RKC6NDPM.woff2 +0 -0
- package/dist/desktop/fonts/shantell-sans-latin-ext-wght-normal-SNKHG3LM.woff2 +0 -0
- package/dist/desktop/fonts/shantell-sans-latin-wght-normal-7CHHGC3N.woff2 +0 -0
- package/dist/desktop/fonts/shantell-sans-vietnamese-wght-normal-IPFAQSBA.woff2 +0 -0
- package/dist/desktop/index.html +14 -0
- package/dist/desktop/styles.css +2 -0
- package/dist/desktop/wasm/isothrum_wasm.d.ts +60 -0
- package/dist/desktop/wasm/isothrum_wasm.js +312 -0
- package/dist/desktop/wasm/isothrum_wasm_bg.wasm +0 -0
- package/dist/index.js +7059 -0
- package/dist/index.js.map +7 -0
- package/dist/model.js +745 -0
- package/dist/model.js.map +7 -0
- package/dist/types/components/tool/canvas/cable-edge.d.ts +4 -0
- package/dist/types/components/tool/canvas/contexts.d.ts +12 -0
- package/dist/types/components/tool/canvas/device-icon.d.ts +17 -0
- package/dist/types/components/tool/canvas/inline-text.d.ts +15 -0
- package/dist/types/components/tool/canvas/lan-node.d.ts +8 -0
- package/dist/types/components/tool/canvas/machine-addresses.d.ts +14 -0
- package/dist/types/components/tool/canvas/machine-node.d.ts +4 -0
- package/dist/types/components/tool/canvas/note-node.d.ts +7 -0
- package/dist/types/components/tool/canvas/port-led.d.ts +10 -0
- package/dist/types/components/tool/canvas/router-node.d.ts +8 -0
- package/dist/types/components/tool/canvas/sketch.d.ts +50 -0
- package/dist/types/components/tool/canvas/status-dot.d.ts +5 -0
- package/dist/types/components/tool/canvas/switch-node.d.ts +8 -0
- package/dist/types/components/tool/canvas/use-measured-ports.d.ts +7 -0
- package/dist/types/components/tool/context-menus.d.ts +5 -0
- package/dist/types/components/tool/device-block.d.ts +12 -0
- package/dist/types/components/tool/editor-menu.d.ts +28 -0
- package/dist/types/components/tool/export/copy-button.d.ts +9 -0
- package/dist/types/components/tool/export/export-panel.d.ts +17 -0
- package/dist/types/components/tool/export/target-list.d.ts +15 -0
- package/dist/types/components/tool/floating-window.d.ts +13 -0
- package/dist/types/components/tool/flow-canvas.d.ts +6 -0
- package/dist/types/components/tool/hooks/use-cabling.d.ts +23 -0
- package/dist/types/components/tool/hooks/use-captures.d.ts +9 -0
- package/dist/types/components/tool/hooks/use-clipboard.d.ts +12 -0
- package/dist/types/components/tool/hooks/use-context-menus.d.ts +25 -0
- package/dist/types/components/tool/hooks/use-design.d.ts +10 -0
- package/dist/types/components/tool/hooks/use-desktop.d.ts +50 -0
- package/dist/types/components/tool/hooks/use-devices.d.ts +17 -0
- package/dist/types/components/tool/hooks/use-downloads.d.ts +9 -0
- package/dist/types/components/tool/hooks/use-editor.d.ts +609 -0
- package/dist/types/components/tool/hooks/use-engine.d.ts +9 -0
- package/dist/types/components/tool/hooks/use-history.d.ts +9 -0
- package/dist/types/components/tool/hooks/use-lab-actions.d.ts +25 -0
- package/dist/types/components/tool/hooks/use-lab-run.d.ts +25 -0
- package/dist/types/components/tool/hooks/use-lab.d.ts +18 -0
- package/dist/types/components/tool/hooks/use-lan-carry.d.ts +8 -0
- package/dist/types/components/tool/hooks/use-machine-actions.d.ts +26 -0
- package/dist/types/components/tool/hooks/use-placement.d.ts +27 -0
- package/dist/types/components/tool/hooks/use-project.d.ts +25 -0
- package/dist/types/components/tool/hooks/use-projects.d.ts +34 -0
- package/dist/types/components/tool/hooks/use-shared-link.d.ts +23 -0
- package/dist/types/components/tool/hooks/use-toast.d.ts +2 -0
- package/dist/types/components/tool/hooks/use-tools.d.ts +17 -0
- package/dist/types/components/tool/lab-canvas.d.ts +18 -0
- package/dist/types/components/tool/overlays.d.ts +5 -0
- package/dist/types/components/tool/projects-list.d.ts +9 -0
- package/dist/types/components/tool/text.d.ts +418 -0
- package/dist/types/components/tool/toolbar.d.ts +5 -0
- package/dist/types/components/tool/top-bars.d.ts +10 -0
- package/dist/types/components/tool/windows/conditions-fields.d.ts +6 -0
- package/dist/types/components/tool/windows/editor-windows.d.ts +5 -0
- package/dist/types/components/tool/windows/fields.d.ts +4 -0
- package/dist/types/components/tool/windows/lab-status.d.ts +6 -0
- package/dist/types/components/tool/windows/lab-windows.d.ts +13 -0
- package/dist/types/components/tool/windows/link-controls.d.ts +21 -0
- package/dist/types/components/tool/windows/machine-controls.d.ts +16 -0
- package/dist/types/components/tool/windows/machine-inspector.d.ts +11 -0
- package/dist/types/components/tool/windows/runs-fields.d.ts +18 -0
- package/dist/types/components/tool/windows/selected-windows.d.ts +21 -0
- package/dist/types/components/ui/button.d.ts +8 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +21 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/lib/auth.d.ts +38 -0
- package/dist/types/lib/brand.d.ts +19 -0
- package/dist/types/lib/i18n.d.ts +19 -0
- package/dist/types/lib/tool/blocks.d.ts +35 -0
- package/dist/types/lib/tool/cables.d.ts +48 -0
- package/dist/types/lib/tool/clone.d.ts +12 -0
- package/dist/types/lib/tool/conditions.d.ts +31 -0
- package/dist/types/lib/tool/create.d.ts +22 -0
- package/dist/types/lib/tool/desktop.d.ts +63 -0
- package/dist/types/lib/tool/draft.d.ts +20 -0
- package/dist/types/lib/tool/engine.d.ts +33 -0
- package/dist/types/lib/tool/examples.d.ts +11 -0
- package/dist/types/lib/tool/export-targets.d.ts +21 -0
- package/dist/types/lib/tool/facing.d.ts +9 -0
- package/dist/types/lib/tool/geometry.d.ts +36 -0
- package/dist/types/lib/tool/gns3-cables.d.ts +17 -0
- package/dist/types/lib/tool/gns3-import.d.ts +15 -0
- package/dist/types/lib/tool/gns3-parts.d.ts +25 -0
- package/dist/types/lib/tool/issues.d.ts +12 -0
- package/dist/types/lib/tool/layout.d.ts +52 -0
- package/dist/types/lib/tool/live.d.ts +21 -0
- package/dist/types/lib/tool/logos.d.ts +7 -0
- package/dist/types/lib/tool/model.d.ts +173 -0
- package/dist/types/lib/tool/os.d.ts +20 -0
- package/dist/types/lib/tool/pins.d.ts +5 -0
- package/dist/types/lib/tool/placement.d.ts +21 -0
- package/dist/types/lib/tool/ports.d.ts +21 -0
- package/dist/types/lib/tool/presets.d.ts +21 -0
- package/dist/types/lib/tool/projects-api.d.ts +37 -0
- package/dist/types/lib/tool/router-ports.d.ts +22 -0
- package/dist/types/lib/tool/selection.d.ts +19 -0
- package/dist/types/lib/tool/storage.d.ts +25 -0
- package/dist/types/lib/tool/switch-edit.d.ts +17 -0
- package/dist/types/lib/tool/text/de.d.ts +2 -0
- package/dist/types/lib/tool/text/en.d.ts +429 -0
- package/dist/types/lib/tool/text/es.d.ts +2 -0
- package/dist/types/lib/tool/text/fr.d.ts +2 -0
- package/dist/types/lib/tool/text/index.d.ts +419 -0
- package/dist/types/lib/tool/topology.d.ts +2 -0
- package/dist/types/lib/tool/vlans.d.ts +24 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/model.d.ts +13 -0
- package/package.json +88 -4
- package/scripts/build-desktop-editor.mjs +43 -0
- package/scripts/build-lib.mjs +38 -0
- package/src/components/tool/canvas/cable-edge.tsx +112 -0
- package/src/components/tool/canvas/contexts.ts +18 -0
- package/src/components/tool/canvas/device-icon.tsx +105 -0
- package/src/components/tool/canvas/inline-text.tsx +69 -0
- package/src/components/tool/canvas/lan-node.tsx +148 -0
- package/src/components/tool/canvas/machine-addresses.tsx +117 -0
- package/src/components/tool/canvas/machine-node.tsx +114 -0
- package/src/components/tool/canvas/note-node.tsx +109 -0
- package/src/components/tool/canvas/port-led.tsx +21 -0
- package/src/components/tool/canvas/router-node.tsx +114 -0
- package/src/components/tool/canvas/sketch.tsx +130 -0
- package/src/components/tool/canvas/status-dot.tsx +29 -0
- package/src/components/tool/canvas/switch-node.tsx +143 -0
- package/src/components/tool/canvas/use-measured-ports.ts +25 -0
- package/src/components/tool/context-menus.tsx +142 -0
- package/src/components/tool/device-block.tsx +107 -0
- package/src/components/tool/editor-menu.tsx +191 -0
- package/src/components/tool/export/copy-button.tsx +45 -0
- package/src/components/tool/export/export-panel.tsx +127 -0
- package/src/components/tool/export/target-list.tsx +87 -0
- package/src/components/tool/floating-window.tsx +69 -0
- package/src/components/tool/flow-canvas.tsx +138 -0
- package/src/components/tool/hooks/use-cabling.ts +66 -0
- package/src/components/tool/hooks/use-captures.ts +24 -0
- package/src/components/tool/hooks/use-clipboard.ts +54 -0
- package/src/components/tool/hooks/use-context-menus.ts +37 -0
- package/src/components/tool/hooks/use-design.ts +24 -0
- package/src/components/tool/hooks/use-desktop.ts +100 -0
- package/src/components/tool/hooks/use-devices.ts +58 -0
- package/src/components/tool/hooks/use-downloads.ts +42 -0
- package/src/components/tool/hooks/use-editor.ts +114 -0
- package/src/components/tool/hooks/use-engine.ts +29 -0
- package/src/components/tool/hooks/use-history.ts +107 -0
- package/src/components/tool/hooks/use-lab-actions.ts +57 -0
- package/src/components/tool/hooks/use-lab-run.ts +61 -0
- package/src/components/tool/hooks/use-lab.ts +32 -0
- package/src/components/tool/hooks/use-lan-carry.ts +43 -0
- package/src/components/tool/hooks/use-machine-actions.ts +57 -0
- package/src/components/tool/hooks/use-placement.ts +80 -0
- package/src/components/tool/hooks/use-project.ts +112 -0
- package/src/components/tool/hooks/use-projects.ts +85 -0
- package/src/components/tool/hooks/use-shared-link.ts +64 -0
- package/src/components/tool/hooks/use-toast.ts +16 -0
- package/src/components/tool/hooks/use-tools.ts +60 -0
- package/src/components/tool/lab-canvas.tsx +96 -0
- package/src/components/tool/overlays.tsx +104 -0
- package/src/components/tool/projects-list.tsx +96 -0
- package/src/components/tool/text.ts +9 -0
- package/src/components/tool/toolbar.tsx +106 -0
- package/src/components/tool/top-bars.tsx +90 -0
- package/src/components/tool/windows/conditions-fields.tsx +43 -0
- package/src/components/tool/windows/editor-windows.tsx +73 -0
- package/src/components/tool/windows/fields.ts +6 -0
- package/src/components/tool/windows/lab-status.tsx +68 -0
- package/src/components/tool/windows/lab-windows.tsx +130 -0
- package/src/components/tool/windows/link-controls.tsx +69 -0
- package/src/components/tool/windows/machine-controls.tsx +116 -0
- package/src/components/tool/windows/machine-inspector.tsx +83 -0
- package/src/components/tool/windows/runs-fields.tsx +127 -0
- package/src/components/tool/windows/selected-windows.tsx +147 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/dropdown-menu.tsx +185 -0
- package/src/index.ts +21 -0
- package/src/lib/auth.tsx +43 -0
- package/src/lib/brand.tsx +46 -0
- package/src/lib/i18n.ts +53 -0
- package/src/lib/tool/blocks.test.ts +64 -0
- package/src/lib/tool/blocks.ts +78 -0
- package/src/lib/tool/cable-wiring.test.ts +74 -0
- package/src/lib/tool/cables.test.ts +75 -0
- package/src/lib/tool/cables.ts +215 -0
- package/src/lib/tool/clone.test.ts +54 -0
- package/src/lib/tool/clone.ts +48 -0
- package/src/lib/tool/conditions.test.ts +170 -0
- package/src/lib/tool/conditions.ts +132 -0
- package/src/lib/tool/create.test.ts +67 -0
- package/src/lib/tool/create.ts +83 -0
- package/src/lib/tool/desktop.test.ts +59 -0
- package/src/lib/tool/desktop.ts +99 -0
- package/src/lib/tool/draft.test.ts +150 -0
- package/src/lib/tool/draft.ts +109 -0
- package/src/lib/tool/engine.test.ts +39 -0
- package/src/lib/tool/engine.ts +58 -0
- package/src/lib/tool/examples.test.ts +35 -0
- package/src/lib/tool/examples.ts +71 -0
- package/src/lib/tool/export-targets.test.ts +47 -0
- package/src/lib/tool/export-targets.ts +84 -0
- package/src/lib/tool/facing.test.ts +72 -0
- package/src/lib/tool/facing.ts +100 -0
- package/src/lib/tool/geometry.test.ts +80 -0
- package/src/lib/tool/geometry.ts +109 -0
- package/src/lib/tool/gns3-cables.test.ts +47 -0
- package/src/lib/tool/gns3-cables.ts +81 -0
- package/src/lib/tool/gns3-import.test.ts +102 -0
- package/src/lib/tool/gns3-import.ts +198 -0
- package/src/lib/tool/gns3-layout.test.ts +62 -0
- package/src/lib/tool/gns3-parts.test.ts +47 -0
- package/src/lib/tool/gns3-parts.ts +68 -0
- package/src/lib/tool/issues.test.ts +35 -0
- package/src/lib/tool/issues.ts +60 -0
- package/src/lib/tool/layout.test.ts +128 -0
- package/src/lib/tool/layout.ts +229 -0
- package/src/lib/tool/live.test.ts +46 -0
- package/src/lib/tool/live.ts +49 -0
- package/src/lib/tool/logos.test.ts +30 -0
- package/src/lib/tool/logos.ts +99 -0
- package/src/lib/tool/model.test.ts +128 -0
- package/src/lib/tool/model.ts +238 -0
- package/src/lib/tool/os.test.ts +45 -0
- package/src/lib/tool/os.ts +57 -0
- package/src/lib/tool/parity.test.ts +145 -0
- package/src/lib/tool/pins.test.ts +24 -0
- package/src/lib/tool/pins.ts +11 -0
- package/src/lib/tool/placement.test.ts +79 -0
- package/src/lib/tool/placement.ts +60 -0
- package/src/lib/tool/ports.test.ts +39 -0
- package/src/lib/tool/ports.ts +48 -0
- package/src/lib/tool/presets.test.ts +50 -0
- package/src/lib/tool/presets.ts +77 -0
- package/src/lib/tool/projects-api.test.ts +59 -0
- package/src/lib/tool/projects-api.ts +47 -0
- package/src/lib/tool/router-ports.test.ts +63 -0
- package/src/lib/tool/router-ports.ts +88 -0
- package/src/lib/tool/selection.test.ts +44 -0
- package/src/lib/tool/selection.ts +34 -0
- package/src/lib/tool/storage.test.ts +123 -0
- package/src/lib/tool/storage.ts +127 -0
- package/src/lib/tool/switch-edit.test.ts +49 -0
- package/src/lib/tool/switch-edit.ts +38 -0
- package/src/lib/tool/text/de.ts +358 -0
- package/src/lib/tool/text/en.ts +371 -0
- package/src/lib/tool/text/es.ts +358 -0
- package/src/lib/tool/text/fr.ts +358 -0
- package/src/lib/tool/text/index.ts +21 -0
- package/src/lib/tool/text/text.test.ts +33 -0
- package/src/lib/tool/topology.test.ts +108 -0
- package/src/lib/tool/topology.ts +116 -0
- package/src/lib/tool/vlans.test.ts +64 -0
- package/src/lib/tool/vlans.ts +79 -0
- package/src/lib/utils.ts +6 -0
- package/src/model.ts +13 -0
- package/src/test/arbitrary.ts +41 -0
- package/src/test/engine.ts +48 -0
- package/src/test/lab.ts +101 -0
- package/styles/globals.css +258 -0
- package/styles/theme.css +192 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +22 -0
- package/wasm/isothrum_wasm.d.ts +60 -0
- package/wasm/isothrum_wasm.js +312 -0
- package/wasm/isothrum_wasm_bg.wasm +0 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { type EditorText } from "./en";
|
|
2
|
+
export type { EditorText };
|
|
3
|
+
export declare function editorText(lang: string): EditorText;
|
|
4
|
+
/** English: the source the other languages follow. */
|
|
5
|
+
export declare const defaultText: {
|
|
6
|
+
toolbar: {
|
|
7
|
+
blocks: {
|
|
8
|
+
switch: string;
|
|
9
|
+
router: string;
|
|
10
|
+
firewall: string;
|
|
11
|
+
container: string;
|
|
12
|
+
vm: string;
|
|
13
|
+
mine: string;
|
|
14
|
+
};
|
|
15
|
+
kindsOf: (block: string) => string;
|
|
16
|
+
devices: string;
|
|
17
|
+
hand: string;
|
|
18
|
+
select: string;
|
|
19
|
+
lan: string;
|
|
20
|
+
lanTitle: string;
|
|
21
|
+
switch: string;
|
|
22
|
+
switchTitle: string;
|
|
23
|
+
note: string;
|
|
24
|
+
noteTitle: string;
|
|
25
|
+
forget: (device: string) => string;
|
|
26
|
+
forgetLabel: (device: string) => string;
|
|
27
|
+
undo: string;
|
|
28
|
+
undoTitle: string;
|
|
29
|
+
redo: string;
|
|
30
|
+
redoTitle: string;
|
|
31
|
+
};
|
|
32
|
+
hints: {
|
|
33
|
+
lan: string;
|
|
34
|
+
note: string;
|
|
35
|
+
place: (device: string) => string;
|
|
36
|
+
hand: string;
|
|
37
|
+
cable: string;
|
|
38
|
+
select: string;
|
|
39
|
+
};
|
|
40
|
+
devices: {
|
|
41
|
+
router: {
|
|
42
|
+
label: string;
|
|
43
|
+
hint: string;
|
|
44
|
+
};
|
|
45
|
+
"router-frr": {
|
|
46
|
+
label: string;
|
|
47
|
+
hint: string;
|
|
48
|
+
};
|
|
49
|
+
firewall: {
|
|
50
|
+
label: string;
|
|
51
|
+
hint: string;
|
|
52
|
+
};
|
|
53
|
+
container: {
|
|
54
|
+
label: string;
|
|
55
|
+
};
|
|
56
|
+
web: {
|
|
57
|
+
label: string;
|
|
58
|
+
hint: string;
|
|
59
|
+
};
|
|
60
|
+
database: {
|
|
61
|
+
label: string;
|
|
62
|
+
hint: string;
|
|
63
|
+
};
|
|
64
|
+
desktop: {
|
|
65
|
+
label: string;
|
|
66
|
+
hint: string;
|
|
67
|
+
};
|
|
68
|
+
"linux-vm": {
|
|
69
|
+
label: string;
|
|
70
|
+
};
|
|
71
|
+
"ubuntu-vm": {
|
|
72
|
+
label: string;
|
|
73
|
+
};
|
|
74
|
+
"kali-vm": {
|
|
75
|
+
label: string;
|
|
76
|
+
};
|
|
77
|
+
"windows-vm": {
|
|
78
|
+
label: string;
|
|
79
|
+
};
|
|
80
|
+
workstation: {
|
|
81
|
+
label: string;
|
|
82
|
+
hint: string;
|
|
83
|
+
};
|
|
84
|
+
"cisco-iol": {
|
|
85
|
+
label: string;
|
|
86
|
+
hint: string;
|
|
87
|
+
};
|
|
88
|
+
"cisco-iol-l2": {
|
|
89
|
+
label: string;
|
|
90
|
+
hint: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
myDevice: (what: string) => string;
|
|
94
|
+
myDeviceRouter: string;
|
|
95
|
+
status: {
|
|
96
|
+
loading: string;
|
|
97
|
+
toFix: (count: number) => string;
|
|
98
|
+
valid: string;
|
|
99
|
+
};
|
|
100
|
+
run: {
|
|
101
|
+
autoStart: string;
|
|
102
|
+
autoStartNote: string;
|
|
103
|
+
statusTitle: (up: number, total: number) => string;
|
|
104
|
+
probed: string;
|
|
105
|
+
inferred: string;
|
|
106
|
+
run: string;
|
|
107
|
+
starting: string;
|
|
108
|
+
stop: string;
|
|
109
|
+
stopping: string;
|
|
110
|
+
vmsTitle: string;
|
|
111
|
+
runVmsTitle: string;
|
|
112
|
+
startingVmsLog: string;
|
|
113
|
+
runTitle: string;
|
|
114
|
+
startingLog: string;
|
|
115
|
+
window: string;
|
|
116
|
+
running: string;
|
|
117
|
+
stopped: string;
|
|
118
|
+
noDocker: string;
|
|
119
|
+
noLiveCapture: (wireshark: boolean, dir: string) => string;
|
|
120
|
+
};
|
|
121
|
+
capture: {
|
|
122
|
+
capturing: (network: string) => string;
|
|
123
|
+
writingTo: string;
|
|
124
|
+
live: string;
|
|
125
|
+
stop: string;
|
|
126
|
+
start: string;
|
|
127
|
+
runFirst: string;
|
|
128
|
+
};
|
|
129
|
+
link: {
|
|
130
|
+
suspend: string;
|
|
131
|
+
resume: string;
|
|
132
|
+
suspendAll: string;
|
|
133
|
+
resumeAll: string;
|
|
134
|
+
cableSuspended: string;
|
|
135
|
+
lanSuspended: (ports: number) => string;
|
|
136
|
+
runFirst: string;
|
|
137
|
+
};
|
|
138
|
+
export: string;
|
|
139
|
+
engineDidntLoad: (error: string) => string;
|
|
140
|
+
engineFailed: (error: string) => string;
|
|
141
|
+
toasts: {
|
|
142
|
+
brokenLink: string;
|
|
143
|
+
openedShared: (lab: string) => string;
|
|
144
|
+
linkCopied: string;
|
|
145
|
+
copyPrompt: string;
|
|
146
|
+
savedDevice: (device: string) => string;
|
|
147
|
+
gns3Opened: (lab: string, machines: number, lans: number) => string;
|
|
148
|
+
undoBringsBack: string;
|
|
149
|
+
gns3Unreadable: string;
|
|
150
|
+
};
|
|
151
|
+
windows: {
|
|
152
|
+
machine: string;
|
|
153
|
+
lan: (lan: string) => string;
|
|
154
|
+
cable: (a: string, b: string) => string;
|
|
155
|
+
portOn: (machine: string) => string;
|
|
156
|
+
cableNote: string;
|
|
157
|
+
removeCable: string;
|
|
158
|
+
conditions: {
|
|
159
|
+
title: string;
|
|
160
|
+
delay: string;
|
|
161
|
+
jitter: string;
|
|
162
|
+
loss: string;
|
|
163
|
+
rate: string;
|
|
164
|
+
hint: string;
|
|
165
|
+
onLan: string;
|
|
166
|
+
onVlan: string;
|
|
167
|
+
};
|
|
168
|
+
selected: (count: number) => string;
|
|
169
|
+
selection: (items: number, cables: number) => string;
|
|
170
|
+
deleteSelection: (count: number) => string;
|
|
171
|
+
close: string;
|
|
172
|
+
};
|
|
173
|
+
lab: {
|
|
174
|
+
title: string;
|
|
175
|
+
containers: string;
|
|
176
|
+
vms: string;
|
|
177
|
+
lans: string;
|
|
178
|
+
cables: string;
|
|
179
|
+
toFix: string;
|
|
180
|
+
valid: string;
|
|
181
|
+
routing: string;
|
|
182
|
+
};
|
|
183
|
+
menu: {
|
|
184
|
+
menu: string;
|
|
185
|
+
example: string;
|
|
186
|
+
vlanExample: string;
|
|
187
|
+
gns3: string;
|
|
188
|
+
gns3File: string;
|
|
189
|
+
share: string;
|
|
190
|
+
fit: string;
|
|
191
|
+
clear: string;
|
|
192
|
+
light: string;
|
|
193
|
+
dark: string;
|
|
194
|
+
style: string;
|
|
195
|
+
styles: {
|
|
196
|
+
sketch: string;
|
|
197
|
+
business: string;
|
|
198
|
+
};
|
|
199
|
+
language: string;
|
|
200
|
+
about: string;
|
|
201
|
+
blog: string;
|
|
202
|
+
};
|
|
203
|
+
welcome: {
|
|
204
|
+
menuHint: string;
|
|
205
|
+
toolbarHint: string;
|
|
206
|
+
pitch: string;
|
|
207
|
+
example: string;
|
|
208
|
+
how: string;
|
|
209
|
+
};
|
|
210
|
+
inspector: {
|
|
211
|
+
name: string;
|
|
212
|
+
runsAs: string;
|
|
213
|
+
automaticRouter: string;
|
|
214
|
+
container: string;
|
|
215
|
+
vm: string;
|
|
216
|
+
routerNote: string;
|
|
217
|
+
image: string;
|
|
218
|
+
keepRunning: string;
|
|
219
|
+
applianceNote: string;
|
|
220
|
+
ciscoOs: string;
|
|
221
|
+
needsKvm: string;
|
|
222
|
+
dynamipsFirmware: (name: string) => string;
|
|
223
|
+
iosConfig: string;
|
|
224
|
+
iosConfigHint: string;
|
|
225
|
+
keepRunningHint: string;
|
|
226
|
+
os: string;
|
|
227
|
+
provision: string;
|
|
228
|
+
ports: string;
|
|
229
|
+
access: string;
|
|
230
|
+
cables: string;
|
|
231
|
+
noCables: string;
|
|
232
|
+
saveTitle: string;
|
|
233
|
+
save: string;
|
|
234
|
+
remove: string;
|
|
235
|
+
};
|
|
236
|
+
canvas: {
|
|
237
|
+
imageShort: string;
|
|
238
|
+
hosts: (n: number) => string;
|
|
239
|
+
roles: {
|
|
240
|
+
router: string;
|
|
241
|
+
firewall: string;
|
|
242
|
+
workstation: string;
|
|
243
|
+
server: string;
|
|
244
|
+
desktop: string;
|
|
245
|
+
host: string;
|
|
246
|
+
};
|
|
247
|
+
switchModel: (ports: number) => string;
|
|
248
|
+
live: {
|
|
249
|
+
up: string;
|
|
250
|
+
starting: string;
|
|
251
|
+
unhealthy: string;
|
|
252
|
+
down: string;
|
|
253
|
+
portUp: string;
|
|
254
|
+
portDown: string;
|
|
255
|
+
portUnknown: string;
|
|
256
|
+
lanPorts: (up: number, total: number) => string;
|
|
257
|
+
cable: {
|
|
258
|
+
up: string;
|
|
259
|
+
cut: string;
|
|
260
|
+
down: string;
|
|
261
|
+
};
|
|
262
|
+
cableShort: {
|
|
263
|
+
cut: string;
|
|
264
|
+
down: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
editTitle: (what: string) => string;
|
|
268
|
+
unnamed: string;
|
|
269
|
+
machineName: string;
|
|
270
|
+
vm: string;
|
|
271
|
+
automatic: string;
|
|
272
|
+
container: string;
|
|
273
|
+
access: string;
|
|
274
|
+
addressTitle: (network: string, fixed: boolean) => string;
|
|
275
|
+
fixed: string;
|
|
276
|
+
addressOn: (network: string) => string;
|
|
277
|
+
lanName: string;
|
|
278
|
+
addressBlock: string;
|
|
279
|
+
internetOnTitle: string;
|
|
280
|
+
internetOffTitle: string;
|
|
281
|
+
internetOn: string;
|
|
282
|
+
internetOff: string;
|
|
283
|
+
showAreaTitle: string;
|
|
284
|
+
hideAreaTitle: string;
|
|
285
|
+
showArea: string;
|
|
286
|
+
hideArea: string;
|
|
287
|
+
switchName: string;
|
|
288
|
+
port: (n: number) => string;
|
|
289
|
+
trunkPort: string;
|
|
290
|
+
trunkCarries: (vlans: string) => string;
|
|
291
|
+
noVlan: string;
|
|
292
|
+
clickToChange: string;
|
|
293
|
+
vlanNumber: string;
|
|
294
|
+
vlanBlock: string;
|
|
295
|
+
remove: (what: string) => string;
|
|
296
|
+
routerName: string;
|
|
297
|
+
portFree: (port: string) => string;
|
|
298
|
+
textOnly: string;
|
|
299
|
+
box: string;
|
|
300
|
+
ellipse: string;
|
|
301
|
+
colors: {
|
|
302
|
+
yellow: string;
|
|
303
|
+
red: string;
|
|
304
|
+
blue: string;
|
|
305
|
+
green: string;
|
|
306
|
+
violet: string;
|
|
307
|
+
};
|
|
308
|
+
color: (color: string) => string;
|
|
309
|
+
write: string;
|
|
310
|
+
note: string;
|
|
311
|
+
noteName: string;
|
|
312
|
+
};
|
|
313
|
+
exportPanel: {
|
|
314
|
+
copy: string;
|
|
315
|
+
copied: string;
|
|
316
|
+
labName: string;
|
|
317
|
+
fixFirst: string;
|
|
318
|
+
download: (lab: string) => string;
|
|
319
|
+
onlySpec: string;
|
|
320
|
+
where: string;
|
|
321
|
+
whereIntro: string;
|
|
322
|
+
mixed: string;
|
|
323
|
+
install: string;
|
|
324
|
+
files: (count: number) => string;
|
|
325
|
+
downloadOnly: (target: string) => string;
|
|
326
|
+
downloadTarget: (target: string) => string;
|
|
327
|
+
withIsoloom: string;
|
|
328
|
+
withTool: string;
|
|
329
|
+
run: string;
|
|
330
|
+
specIntro: string;
|
|
331
|
+
showSpec: string;
|
|
332
|
+
hideSpec: string;
|
|
333
|
+
containersAndVms: string;
|
|
334
|
+
dockerOnOneVm: string;
|
|
335
|
+
oneVmPerMachine: string;
|
|
336
|
+
};
|
|
337
|
+
issues: {
|
|
338
|
+
vlanBlocks: (vlan: string, block: string, other: string, sw: string) => string;
|
|
339
|
+
areaBlock: (lan: string, block: string, switches: string) => string;
|
|
340
|
+
noName: {
|
|
341
|
+
machine: string;
|
|
342
|
+
lan: string;
|
|
343
|
+
switch: string;
|
|
344
|
+
};
|
|
345
|
+
sameName: {
|
|
346
|
+
machine: (name: string) => string;
|
|
347
|
+
lan: (name: string) => string;
|
|
348
|
+
switch: (name: string) => string;
|
|
349
|
+
};
|
|
350
|
+
badPort: (machine: string, entry: string) => string;
|
|
351
|
+
};
|
|
352
|
+
gns3: {
|
|
353
|
+
notGns3: string;
|
|
354
|
+
noTopology: string;
|
|
355
|
+
cisco: (node: string, kind: string) => string;
|
|
356
|
+
firewall: (node: string) => string;
|
|
357
|
+
noEquivalent: (node: string, type: string) => string;
|
|
358
|
+
noNodes: string;
|
|
359
|
+
};
|
|
360
|
+
account: {
|
|
361
|
+
signIn: string;
|
|
362
|
+
signOut: string;
|
|
363
|
+
signedInAs: (name: string) => string;
|
|
364
|
+
};
|
|
365
|
+
projects: {
|
|
366
|
+
save: string;
|
|
367
|
+
saveAs: string;
|
|
368
|
+
openList: string;
|
|
369
|
+
saveAsPrompt: string;
|
|
370
|
+
windowTitle: string;
|
|
371
|
+
loading: string;
|
|
372
|
+
none: string;
|
|
373
|
+
open: string;
|
|
374
|
+
openButton: string;
|
|
375
|
+
delete: (name: string) => string;
|
|
376
|
+
confirmDelete: (name: string) => string;
|
|
377
|
+
failed: (error: string) => string;
|
|
378
|
+
history: (name: string) => string;
|
|
379
|
+
noVersions: string;
|
|
380
|
+
restore: string;
|
|
381
|
+
historyHint: string;
|
|
382
|
+
opened: (name: string) => string;
|
|
383
|
+
status: {
|
|
384
|
+
idle: (name: string) => string;
|
|
385
|
+
saving: (name: string) => string;
|
|
386
|
+
saved: (name: string) => string;
|
|
387
|
+
error: (name: string) => string;
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
machineRun: {
|
|
391
|
+
display: string;
|
|
392
|
+
displayTitle: string;
|
|
393
|
+
displayOpened: (what: string) => string;
|
|
394
|
+
consoleHint: string;
|
|
395
|
+
runFirst: string;
|
|
396
|
+
running: string;
|
|
397
|
+
stopped: string;
|
|
398
|
+
unknown: string;
|
|
399
|
+
console: string;
|
|
400
|
+
restart: string;
|
|
401
|
+
stop: string;
|
|
402
|
+
start: string;
|
|
403
|
+
snapshots: string;
|
|
404
|
+
takeSnapshot: string;
|
|
405
|
+
snapshotHint: string;
|
|
406
|
+
snapshotPrompt: string;
|
|
407
|
+
noSnapshots: string;
|
|
408
|
+
restore: string;
|
|
409
|
+
inUse: string;
|
|
410
|
+
ownImage: string;
|
|
411
|
+
deleteSnapshot: (label: string) => string;
|
|
412
|
+
};
|
|
413
|
+
update: {
|
|
414
|
+
available: (version: string) => string;
|
|
415
|
+
restart: string;
|
|
416
|
+
installing: string;
|
|
417
|
+
later: string;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CableEdge, type LabNode, type SwitchNode } from "./model";
|
|
2
|
+
/** VLANs and switch ports. VLANs are lab-wide: `vlan10` is the same network on every switch. */
|
|
3
|
+
export declare const vlanName: (id: number) => string;
|
|
4
|
+
export declare function vlanColor(id: number): string;
|
|
5
|
+
/** A trunk port's look: striped with the colors of the VLANs it carries (muted when none). */
|
|
6
|
+
export declare function trunkStripes(vlans: {
|
|
7
|
+
id: number;
|
|
8
|
+
}[]): string;
|
|
9
|
+
/** The VLAN number in a LAN's name (`vlan10` -> 10), when the LAN is a VLAN. */
|
|
10
|
+
export declare function vlanOf(lanName: string): number | null;
|
|
11
|
+
/** Whether a switch handle is a trunk: the T port, or any port set to "trunk". */
|
|
12
|
+
export declare function isTrunkPort(sw: SwitchNode, handle: string | null | undefined): boolean;
|
|
13
|
+
/** The VLAN of an access port, or null (a trunk, an unassigned port, not a port). */
|
|
14
|
+
export declare function accessVlan(sw: SwitchNode, handle: string | null | undefined): number | null;
|
|
15
|
+
/** A port's label next to its cable: 1, 2… or T. */
|
|
16
|
+
export declare function switchPortLabel(handle: string | null | undefined): string;
|
|
17
|
+
/**
|
|
18
|
+
* The LAN each switch's VLANs belong to in isoloom.yml: switches joined by a cable, or sharing a
|
|
19
|
+
* VLAN number (VLANs are lab-wide here), are one LAN, named after the first. Returns a switch's
|
|
20
|
+
* LAN name by its id.
|
|
21
|
+
*/
|
|
22
|
+
export declare function switchLans(nodes: LabNode[], edges: CableEdge[]): (switchId: string) => string;
|
|
23
|
+
/** The name Isoloom gives a trunk's interface: its LAN's, within Linux's limit (`sw1`, then `sw1.10`). */
|
|
24
|
+
export declare const trunkInterface: (lan: string) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor's lab model and conversions, with no React: a lab's nodes and cables, the topology the
|
|
3
|
+
* engine reads, and helpers to lay a topology out again. Used by hosts that work with labs outside
|
|
4
|
+
* the canvas (the website's MCP server builds and reads topologies with these).
|
|
5
|
+
*/
|
|
6
|
+
export * from "./lib/tool/model.js";
|
|
7
|
+
export { type Topology, type LaidOut, draftFromTopology } from "./lib/tool/layout.js";
|
|
8
|
+
export { toTopology } from "./lib/tool/topology.js";
|
|
9
|
+
export { PORT_PROTOCOLS, readPorts, portsText, type Service } from "./lib/tool/ports.js";
|
|
10
|
+
export { exampleLab, vlanExample } from "./lib/tool/examples.js";
|
|
11
|
+
export { planOf, ownFiles, type Engine, type Plan, type GeneratedFile } from "./lib/tool/engine.js";
|
|
12
|
+
export { groupByTarget, type Target, type TargetText } from "./lib/tool/export-targets.js";
|
|
13
|
+
export { canvasIssues, type IssueText } from "./lib/tool/issues.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,90 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isothrum/editor",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Isothrum lab editor: a React canvas that draws infrastructure labs and compiles them to an Isoloom spec, plus the Isothrum WebAssembly engine. Shared by the Isothrum desktop app and isothrum.com.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./model": {
|
|
15
|
+
"types": "./dist/types/model.d.ts",
|
|
16
|
+
"import": "./dist/model.js",
|
|
17
|
+
"default": "./dist/model.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles/globals.css": "./styles/globals.css",
|
|
20
|
+
"./styles/theme.css": "./styles/theme.css",
|
|
21
|
+
"./wasm/isothrum_wasm.js": "./wasm/isothrum_wasm.js",
|
|
22
|
+
"./wasm/isothrum_wasm_bg.wasm": "./wasm/isothrum_wasm_bg.wasm",
|
|
23
|
+
"./build-desktop-editor": "./scripts/build-desktop-editor.mjs",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"src",
|
|
29
|
+
"styles",
|
|
30
|
+
"wasm",
|
|
31
|
+
"desktop-editor",
|
|
32
|
+
"scripts",
|
|
33
|
+
"tsconfig.json",
|
|
34
|
+
"tsconfig.build.json",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"NOTICE",
|
|
38
|
+
"PUBLISHING.md"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "npm run build:lib && npm run build:types && npm run build:desktop",
|
|
42
|
+
"build:lib": "node scripts/build-lib.mjs",
|
|
43
|
+
"build:types": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
44
|
+
"build:desktop": "node scripts/build-desktop-editor.mjs dist/desktop",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"check": "npm run typecheck && npm run test && npm run build",
|
|
48
|
+
"prepack": "npm run build"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@xyflow/react": "^12.12.0",
|
|
52
|
+
"next-themes": "^0.4.6",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@base-ui/react": "^1.5.0",
|
|
58
|
+
"class-variance-authority": "^0.7.1",
|
|
59
|
+
"clsx": "^2.1.1",
|
|
60
|
+
"lucide-react": "^1.16.0",
|
|
61
|
+
"roughjs": "^4.6.6",
|
|
62
|
+
"simple-icons": "^16.34.0",
|
|
63
|
+
"tailwind-merge": "^3.6.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
67
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
68
|
+
"@fontsource-variable/shantell-sans": "^5.3.0",
|
|
69
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
70
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
71
|
+
"@types/node": "^20",
|
|
72
|
+
"@types/react": "^19",
|
|
73
|
+
"@types/react-dom": "^19",
|
|
74
|
+
"@xyflow/react": "^12.12.0",
|
|
75
|
+
"esbuild": "^0.28.2",
|
|
76
|
+
"fast-check": "^4.10.2",
|
|
77
|
+
"next-themes": "^0.4.6",
|
|
78
|
+
"react": "19.2.4",
|
|
79
|
+
"react-dom": "19.2.4",
|
|
80
|
+
"shadcn": "^4.8.0",
|
|
81
|
+
"tailwindcss": "^4",
|
|
82
|
+
"tsc-alias": "^1.8.10",
|
|
83
|
+
"tw-animate-css": "^1.4.0",
|
|
84
|
+
"typescript": "^5",
|
|
85
|
+
"vitest": "^4.1.11"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=20"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Builds the editor as a static page for a desktop/offline host (Tauri): the script, the styles,
|
|
3
|
+
// the fonts and the WebAssembly engine, into the folder given (default out-desktop/).
|
|
4
|
+
// node scripts/build-desktop-editor.mjs [out]
|
|
5
|
+
import { build } from "esbuild";
|
|
6
|
+
import { execFileSync } from "node:child_process";
|
|
7
|
+
import { cpSync, mkdirSync, rmSync } from "node:fs";
|
|
8
|
+
import { join, resolve } from "node:path";
|
|
9
|
+
|
|
10
|
+
const root = resolve(import.meta.dirname, "..");
|
|
11
|
+
const out = resolve(process.argv[2] ?? join(root, "out-desktop"));
|
|
12
|
+
rmSync(out, { recursive: true, force: true });
|
|
13
|
+
mkdirSync(out, { recursive: true });
|
|
14
|
+
|
|
15
|
+
await build({
|
|
16
|
+
entryPoints: { editor: join(root, "desktop-editor/main.tsx") },
|
|
17
|
+
bundle: true,
|
|
18
|
+
format: "esm",
|
|
19
|
+
outdir: out,
|
|
20
|
+
minify: true,
|
|
21
|
+
sourcemap: false,
|
|
22
|
+
jsx: "automatic",
|
|
23
|
+
loader: { ".woff2": "file", ".woff": "file" },
|
|
24
|
+
assetNames: "fonts/[name]-[hash]",
|
|
25
|
+
// The package's "@/..." imports resolve to src/.
|
|
26
|
+
alias: { "@": join(root, "src") },
|
|
27
|
+
define: {
|
|
28
|
+
"process.env.NODE_ENV": '"production"',
|
|
29
|
+
},
|
|
30
|
+
// Some libraries read process.env beyond what's defined above: no Node here.
|
|
31
|
+
banner: { js: 'globalThis.process ??= { env: { NODE_ENV: "production" } };' },
|
|
32
|
+
// The engine is loaded at run time from /wasm, as on the site.
|
|
33
|
+
external: ["/wasm/*"],
|
|
34
|
+
logLevel: "warning",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
execFileSync(join(root, "node_modules/.bin/tailwindcss"), ["-i", join(root, "desktop-editor/editor.css"), "-o", join(out, "styles.css"), "--minify"], {
|
|
38
|
+
cwd: root,
|
|
39
|
+
stdio: ["ignore", "ignore", "inherit"],
|
|
40
|
+
});
|
|
41
|
+
cpSync(join(root, "desktop-editor/index.html"), join(out, "index.html"));
|
|
42
|
+
cpSync(join(root, "wasm"), join(out, "wasm"), { recursive: true });
|
|
43
|
+
console.log(`desktop editor: ${out}`);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Bundles the package's two entries to ESM, leaving every dependency external so the host's bundler
|
|
3
|
+
// resolves and dedupes them (React above all). Types are emitted separately by tsc.
|
|
4
|
+
// node scripts/build-lib.mjs
|
|
5
|
+
import { build } from "esbuild";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
|
|
8
|
+
const root = resolve(import.meta.dirname, "..");
|
|
9
|
+
|
|
10
|
+
const common = {
|
|
11
|
+
bundle: true,
|
|
12
|
+
format: "esm",
|
|
13
|
+
platform: "neutral",
|
|
14
|
+
target: "es2020",
|
|
15
|
+
jsx: "automatic",
|
|
16
|
+
sourcemap: true,
|
|
17
|
+
// "@/..." resolves to src/; everything else stays an external import.
|
|
18
|
+
alias: { "@": resolve(root, "src") },
|
|
19
|
+
packages: "external",
|
|
20
|
+
logLevel: "warning",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// The React component entry: a client module for the host (Next marks it so).
|
|
24
|
+
await build({
|
|
25
|
+
...common,
|
|
26
|
+
entryPoints: { index: resolve(root, "src/index.ts") },
|
|
27
|
+
outdir: resolve(root, "dist"),
|
|
28
|
+
banner: { js: '"use client";' },
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// The pure lab-model entry: no React, safe on a server (no "use client").
|
|
32
|
+
await build({
|
|
33
|
+
...common,
|
|
34
|
+
entryPoints: { model: resolve(root, "src/model.ts") },
|
|
35
|
+
outdir: resolve(root, "dist"),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
console.log("lib: dist/index.js, dist/model.js");
|