@tumaet/apollon 4.2.17 → 4.2.20

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 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,85 @@
1
+ # @tumaet/apollon
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@tumaet/apollon)](https://www.npmjs.com/package/@tumaet/apollon)
4
+ [![npm license](https://img.shields.io/npm/l/@tumaet/apollon)](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
+ ## Install
9
+
10
+ ```sh
11
+ npm install @tumaet/apollon
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import {
18
+ ApollonEditor,
19
+ ApollonMode,
20
+ Locale,
21
+ UMLDiagramType,
22
+ } from "@tumaet/apollon"
23
+
24
+ const container = document.getElementById("apollon")
25
+ if (!container) throw new Error("#apollon container missing")
26
+
27
+ const editor = new ApollonEditor(container, {
28
+ type: UMLDiagramType.ClassDiagram,
29
+ mode: ApollonMode.Modelling,
30
+ locale: Locale.en,
31
+ // model, theme, readonly, enablePopups, colorEnabled, scale,
32
+ // collaborationEnabled, scrollLock — see `ApollonOptions`
33
+ })
34
+
35
+ // Read / write the model
36
+ console.log(editor.model)
37
+ editor.model = nextModel
38
+
39
+ // React to edits
40
+ const subscriptionId = editor.subscribeToModelChange((model) => {
41
+ // persist / broadcast
42
+ })
43
+
44
+ // Export
45
+ const svg = await editor.exportAsSVG({ svgMode: "web" })
46
+
47
+ // Teardown
48
+ editor.unsubscribe(subscriptionId)
49
+ editor.destroy()
50
+ ```
51
+
52
+ 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.
53
+
54
+ Type definitions ship with the package (`dist/index.d.ts`).
55
+
56
+ ## Supported diagrams
57
+
58
+ `ClassDiagram`, `ObjectDiagram`, `ActivityDiagram`, `UseCaseDiagram`, `CommunicationDiagram`, `ComponentDiagram`, `DeploymentDiagram`, `PetriNet`, `ReachabilityGraph`, `SyntaxTree`, `Flowchart`, `BPMN`, `Sfc` (Sequential Function Chart).
59
+
60
+ ## Real-time collaboration
61
+
62
+ Collaboration is opt-in and transport-agnostic. Enable `collaborationEnabled` in `ApollonOptions`, then wire your transport to the editor's Yjs bridge:
63
+
64
+ ```ts
65
+ editor.sendBroadcastMessage((base64) => transport.send(base64))
66
+ transport.onMessage((base64) => editor.receiveBroadcastedMessage(base64))
67
+ ```
68
+
69
+ Use any Yjs-compatible transport (WebSocket, WebRTC, `y-websocket`, etc.).
70
+
71
+ ## Export
72
+
73
+ - `editor.exportAsSVG(options)` resolves to `{ svg, clip }` — render or serialize as-is.
74
+ - PNG and PDF use the same pipeline via `ExportOptions` (`svgMode: "web" | "compat"`); see `dist/index.d.ts`.
75
+ - `editor.model` returns the `UMLModel` as JSON.
76
+
77
+ ## Related
78
+
79
+ - Source and issue tracker: <https://github.com/ls1intum/Apollon>
80
+ - Standalone web editor, server, and mobile apps live in the same monorepo.
81
+ - Developed alongside [Artemis](https://artemis.tum.de/), TUM's interactive learning platform.
82
+
83
+ ## License
84
+
85
+ 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.17",
3
+ "version": "4.2.20",
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",
@@ -1,8 +0,0 @@
1
- interface GridHandlesProps {
2
- width: number;
3
- height: number;
4
- gridSize?: number;
5
- isDiagramModifiable: boolean;
6
- }
7
- export declare function GridHandles({ width, height, gridSize, isDiagramModifiable, }: GridHandlesProps): JSX.Element;
8
- export {};