@tumaet/apollon 4.2.17 → 4.2.18
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 +21 -0
- package/README.md +87 -0
- package/package.json +38 -2
- package/dist/nodes/wrappers/GridHandles.d.ts +0 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 TUM Applied Education Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @tumaet/apollon
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@tumaet/apollon)
|
|
4
|
+
[](https://github.com/ls1intum/Apollon/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
A UML modeling editor for React. Mount it into any DOM node. 13 diagram types, SVG/PNG/PDF/JSON export, optional real-time collaboration via Yjs.
|
|
7
|
+
|
|
8
|
+
> Replaces the deprecated [`@ls1intum/apollon`](https://www.npmjs.com/package/@ls1intum/apollon) — see that page for the migration guide.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @tumaet/apollon
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import {
|
|
20
|
+
ApollonEditor,
|
|
21
|
+
ApollonMode,
|
|
22
|
+
Locale,
|
|
23
|
+
UMLDiagramType,
|
|
24
|
+
} from "@tumaet/apollon"
|
|
25
|
+
|
|
26
|
+
const container = document.getElementById("apollon")
|
|
27
|
+
if (!container) throw new Error("#apollon container missing")
|
|
28
|
+
|
|
29
|
+
const editor = new ApollonEditor(container, {
|
|
30
|
+
type: UMLDiagramType.ClassDiagram,
|
|
31
|
+
mode: ApollonMode.Modelling,
|
|
32
|
+
locale: Locale.en,
|
|
33
|
+
// model, theme, readonly, enablePopups, colorEnabled, scale,
|
|
34
|
+
// collaborationEnabled, scrollLock — see `ApollonOptions`
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// Read / write the model
|
|
38
|
+
console.log(editor.model)
|
|
39
|
+
editor.model = nextModel
|
|
40
|
+
|
|
41
|
+
// React to edits
|
|
42
|
+
const subscriptionId = editor.subscribeToModelChange((model) => {
|
|
43
|
+
// persist / broadcast
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// Export
|
|
47
|
+
const svg = await editor.exportAsSVG({ svgMode: "web" })
|
|
48
|
+
|
|
49
|
+
// Teardown
|
|
50
|
+
editor.unsubscribe(subscriptionId)
|
|
51
|
+
editor.destroy()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The editor mounts into the DOM and is client-only. In SSR frameworks (Next.js, Remix), instantiate inside `useEffect` or behind a dynamic import. Call `editor.destroy()` before re-mounting on the same container.
|
|
55
|
+
|
|
56
|
+
Type definitions ship with the package (`dist/index.d.ts`).
|
|
57
|
+
|
|
58
|
+
## Supported diagrams
|
|
59
|
+
|
|
60
|
+
`ClassDiagram`, `ObjectDiagram`, `ActivityDiagram`, `UseCaseDiagram`, `CommunicationDiagram`, `ComponentDiagram`, `DeploymentDiagram`, `PetriNet`, `ReachabilityGraph`, `SyntaxTree`, `Flowchart`, `BPMN`, `Sfc` (Sequential Function Chart).
|
|
61
|
+
|
|
62
|
+
## Real-time collaboration
|
|
63
|
+
|
|
64
|
+
Collaboration is opt-in and transport-agnostic. Enable `collaborationEnabled` in `ApollonOptions`, then wire your transport to the editor's Yjs bridge:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
editor.sendBroadcastMessage((base64) => transport.send(base64))
|
|
68
|
+
transport.onMessage((base64) => editor.receiveBroadcastedMessage(base64))
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use any Yjs-compatible transport (WebSocket, WebRTC, `y-websocket`, etc.).
|
|
72
|
+
|
|
73
|
+
## Export
|
|
74
|
+
|
|
75
|
+
- `editor.exportAsSVG(options)` resolves to `{ svg, clip }` — render or serialize as-is.
|
|
76
|
+
- PNG and PDF use the same pipeline via `ExportOptions` (`svgMode: "web" | "compat"`); see `dist/index.d.ts`.
|
|
77
|
+
- `editor.model` returns the `UMLModel` as JSON.
|
|
78
|
+
|
|
79
|
+
## Related
|
|
80
|
+
|
|
81
|
+
- Source and issue tracker: <https://github.com/ls1intum/Apollon>
|
|
82
|
+
- Standalone web editor, server, and mobile apps live in the same monorepo.
|
|
83
|
+
- Developed alongside [Artemis](https://artemis.tum.de/), TUM's interactive learning platform.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT — see [LICENSE](https://github.com/ls1intum/Apollon/blob/main/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tumaet/apollon",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.18",
|
|
4
|
+
"description": "An embeddable UML modeling editor for React. 13 diagram types, SVG/PNG/PDF/JSON export, optional real-time collaboration via Yjs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"apollon",
|
|
7
|
+
"uml",
|
|
8
|
+
"uml-editor",
|
|
9
|
+
"diagram",
|
|
10
|
+
"diagram-editor",
|
|
11
|
+
"modeling",
|
|
12
|
+
"react",
|
|
13
|
+
"typescript",
|
|
14
|
+
"collaborative",
|
|
15
|
+
"yjs",
|
|
16
|
+
"bpmn",
|
|
17
|
+
"petri-net",
|
|
18
|
+
"activity-diagram",
|
|
19
|
+
"class-diagram",
|
|
20
|
+
"flowchart"
|
|
21
|
+
],
|
|
22
|
+
"homepage": "https://github.com/ls1intum/Apollon#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/ls1intum/Apollon/issues"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/ls1intum/Apollon.git",
|
|
29
|
+
"directory": "library"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"author": {
|
|
33
|
+
"name": "TUM Applied Education Technologies",
|
|
34
|
+
"url": "https://aet.cit.tum.de/"
|
|
35
|
+
},
|
|
36
|
+
"funding": "https://github.com/ls1intum/Apollon",
|
|
4
37
|
"type": "module",
|
|
5
38
|
"main": "dist/index.js",
|
|
6
39
|
"types": "dist/index.d.ts",
|
|
7
40
|
"source": "lib/index.tsx",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.0.0"
|
|
43
|
+
},
|
|
8
44
|
"publishConfig": {
|
|
9
45
|
"access": "public"
|
|
10
46
|
},
|
|
@@ -29,7 +65,6 @@
|
|
|
29
65
|
"@emotion/react": "11.11.1",
|
|
30
66
|
"@emotion/styled": "11.11.0",
|
|
31
67
|
"@mui/material": "6.4.2",
|
|
32
|
-
"@types/node": "22.13.8",
|
|
33
68
|
"@xyflow/react": "12.3.6",
|
|
34
69
|
"react": "18.3.1",
|
|
35
70
|
"react-dom": "18.3.1",
|
|
@@ -42,6 +77,7 @@
|
|
|
42
77
|
"@testing-library/jest-dom": "^6.9.1",
|
|
43
78
|
"@testing-library/react": "^16.3.2",
|
|
44
79
|
"@testing-library/user-event": "^14.6.1",
|
|
80
|
+
"@types/node": "22.13.8",
|
|
45
81
|
"@vitejs/plugin-react": "4.3.4",
|
|
46
82
|
"@vitest/coverage-v8": "^4.0.18",
|
|
47
83
|
"eslint": "9.17.0",
|