@tumaet/apollon 4.7.0 → 4.9.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/README.md +45 -20
- package/dist/assets/style.css +1 -1
- package/dist/export.d.ts +73 -0
- package/dist/export.js +219 -0
- package/dist/exportStyles-Co-WBqTa.js +5 -0
- package/dist/external/LICENSE-InterFont +92 -0
- package/dist/external/exportFonts-DxO9jrR1.js +19 -0
- package/dist/external/exportStyles-Co-WBqTa.js +5 -0
- package/dist/external/index.js +22191 -0
- package/dist/fontStack-DOtVH2j8.js +5 -0
- package/dist/index.d.ts +150 -3
- package/dist/index.js +19993 -19219
- package/dist/internals.d.ts +65 -1
- package/dist/internals.js +14 -12
- package/dist/react/apollon-editor.d.ts +56 -3
- package/dist/react/components/AlignmentGuides.d.ts +1 -1
- package/dist/react/components/CustomControls.d.ts +7 -0
- package/dist/react/components/DraggableGhost.d.ts +5 -0
- package/dist/react/components/popovers/PopoverManager.d.ts +1 -1
- package/dist/react/components/popovers/activityDiagram/ActivitySwimlaneEditPopover.d.ts +2 -0
- package/dist/react/components/popovers/activityDiagram/index.d.ts +1 -0
- package/dist/react/components/react/ApollonControl.d.ts +18 -0
- package/dist/react/components/svgs/nodes/InterfaceLabel.d.ts +26 -0
- package/dist/react/components/svgs/nodes/activityDiagram/ActivitySwimlaneSVG.d.ts +9 -0
- package/dist/react/components/svgs/nodes/activityDiagram/index.d.ts +1 -0
- package/dist/react/components/svgs/nodes/componentDiagram/ComponentInterfaceNodeSVG.d.ts +2 -0
- package/dist/react/components/svgs/nodes/deploymentDiagram/DeploymentInterfaceSVG.d.ts +2 -0
- package/dist/react/constants.d.ts +28 -0
- package/dist/react/edges/labelTypes/EdgeIncludeExtendLabel.d.ts +1 -4
- package/dist/react/edges/labelTypes/EdgeMiddleLabels.d.ts +7 -4
- package/dist/react/edges/labelTypes/EdgeMultipleLabels.d.ts +2 -3
- package/dist/react/edges/labelTypes/messageLayout.d.ts +51 -0
- package/dist/react/export/exportErrors.d.ts +10 -0
- package/dist/react/export/index.d.ts +13 -0
- package/dist/react/export/normalizeExportSvg.d.ts +16 -0
- package/dist/react/export/preProcessSvgForPdf.d.ts +20 -0
- package/dist/react/export/svgToPdf.d.ts +17 -0
- package/dist/react/export/svgToPng.d.ts +38 -0
- package/dist/react/exportStyles-yVX7Dykt.js +6 -0
- package/dist/react/hooks/index.d.ts +0 -1
- package/dist/react/hooks/useRemoteDraggingNodes.d.ts +20 -0
- package/dist/react/hooks/useStepPathEdge.d.ts +11 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/nodes/activityDiagram/ActivitySwimlane.d.ts +3 -0
- package/dist/react/nodes/activityDiagram/index.d.ts +1 -0
- package/dist/react/nodes/types.d.ts +2 -1
- package/dist/react/overlay/OverlayLayer.d.ts +8 -0
- package/dist/react/overlay/RegionMount.d.ts +10 -0
- package/dist/react/overlay/overlayStore.d.ts +20 -0
- package/dist/react/overlay/types.d.ts +48 -0
- package/dist/react/react.d.ts +1 -0
- package/dist/react/react.js +13625 -18669
- package/dist/react/store/context.d.ts +3 -0
- package/dist/react/store/diagramStore.d.ts +17 -1
- package/dist/react/sync/perfCounters.d.ts +6 -0
- package/dist/react/sync/ydoc.d.ts +2 -0
- package/dist/react/sync/yjsSync.d.ts +3 -2
- package/dist/react/types/nodes/NodeProps.d.ts +24 -0
- package/dist/react/typings.d.ts +17 -0
- package/dist/react/utils/collaboration.d.ts +10 -1
- package/dist/react/utils/exportUtils.d.ts +0 -130
- package/dist/react/utils/geometry/edgeLabelLayout.d.ts +123 -0
- package/dist/react/utils/geometry/interfaceLabelLayout.d.ts +44 -0
- package/dist/react/utils/index.d.ts +1 -0
- package/dist/react/utils/paletteLayout.d.ts +70 -0
- package/dist/react/utils/swimlaneUtils.d.ts +58 -0
- package/dist/yjsSync-BCNFF_EI.js +45418 -0
- package/package.json +33 -8
- package/schema/uml-model-4.schema.json +1 -0
- package/dist/exportStyles-Xk-Vm7Ul.js +0 -5
- package/dist/react/exportStyles-DZCHk5mK.js +0 -6
- package/dist/react/hooks/useMessagePositioning.d.ts +0 -30
- package/dist/yjsSync-aPxjWNdZ.js +0 -50939
package/README.md
CHANGED
|
@@ -23,24 +23,28 @@ Apollon is the modeling editor behind [Artemis](https://artemis.tum.de/), TUM's
|
|
|
23
23
|
- **Framework-agnostic**: one imperative API for Angular, Vue, Svelte, and vanilla JS, plus a React component, hooks, and provider.
|
|
24
24
|
- **Real-time collaboration**: opt-in multi-user editing over [Yjs](https://yjs.dev/), with any transport you like (WebSocket, WebRTC, BroadcastChannel).
|
|
25
25
|
- **Export**: SVG and JSON are built in. Generate PNG and PDF from the SVG (see [Export](#export)).
|
|
26
|
+
- **Canvas overlays**: inject your own toolbars, banners, and rails into the editor canvas, collision-free with built-in chrome — `<ApollonControl>` (React) or `addControl` / `getRegionElement` (any framework). See [Overlay controls](https://ls1intum.github.io/Apollon/library/api/overlay-controls).
|
|
26
27
|
- **Assessment mode**: attach scores and feedback to elements. This is the grading workflow Artemis uses.
|
|
27
28
|
- **TypeScript**: type definitions are included.
|
|
28
29
|
|
|
29
30
|
## Install
|
|
30
31
|
|
|
31
|
-
The package ships
|
|
32
|
+
The package ships three builds with the same imperative API. Pick one based on how your host bundles (or doesn't):
|
|
32
33
|
|
|
33
|
-
| Import |
|
|
34
|
-
| ----------------------------- |
|
|
35
|
-
| `@tumaet/apollon` _(default)_ | **bundled**
|
|
36
|
-
| `@tumaet/apollon/react` | **
|
|
34
|
+
| Import | Dependencies | Size (min / gzip) | Use when |
|
|
35
|
+
| ----------------------------- | ---------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| `@tumaet/apollon` _(default)_ | **all bundled** (except Yjs) | ~2.4 MB / ~540 KB | No bundler — vanilla JS, a `<script>` tag, or a CDN. Self-contained; only `yjs` + `y-protocols` to install. |
|
|
37
|
+
| `@tumaet/apollon/react` | **React family external** | ~875 KB / ~170 KB | A React host that shares its own React and MUI with the editor. Also ships the `<Apollon>` component, hooks, provider. |
|
|
38
|
+
| `@tumaet/apollon/external` | **everything external** | ~840 KB / ~175 KB | A bundler host (Angular, Vue, Svelte, React) that wants every dependency resolved from its own `node_modules` — one shared copy and full SBOM / audit visibility. |
|
|
37
39
|
|
|
38
|
-
Sizes are the published entry chunks. Gzip is the transfer size. The `/react`
|
|
40
|
+
Sizes are the published entry chunks. Gzip is the transfer size. The `/react` and `/external` numbers exclude the peers your app already ships.
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
`yjs` and `y-protocols` are required peer dependencies of **all three** builds — they power Apollon's document model and undo/redo (and live collaboration when you enable it), so every editor needs them, collaboration or not. Keeping them external means a host that already uses Yjs (or a second Apollon on the page) shares a single Yjs instance instead of loading a private, possibly mismatched copy. Most package managers install missing peers automatically; the explicit commands below are listed for clarity.
|
|
43
|
+
|
|
44
|
+
### Standalone build (any framework)
|
|
41
45
|
|
|
42
46
|
```sh
|
|
43
|
-
npm install @tumaet/apollon
|
|
47
|
+
npm install @tumaet/apollon yjs y-protocols
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
```ts
|
|
@@ -48,12 +52,13 @@ import { ApollonEditor } from "@tumaet/apollon"
|
|
|
48
52
|
import "@tumaet/apollon/style.css"
|
|
49
53
|
```
|
|
50
54
|
|
|
51
|
-
React, MUI, emotion, and xyflow are bundled in
|
|
55
|
+
React, MUI, emotion, and xyflow are bundled in; only `yjs` and `y-protocols` are peers you provide.
|
|
52
56
|
|
|
53
57
|
### React build (share your host's React)
|
|
54
58
|
|
|
55
59
|
```sh
|
|
56
60
|
npm install @tumaet/apollon \
|
|
61
|
+
yjs y-protocols \
|
|
57
62
|
react react-dom \
|
|
58
63
|
@emotion/react @emotion/styled @mui/material @xyflow/react
|
|
59
64
|
```
|
|
@@ -63,18 +68,36 @@ import { Apollon } from "@tumaet/apollon/react"
|
|
|
63
68
|
import "@tumaet/apollon/style.css"
|
|
64
69
|
```
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
| --------------- | --------- | --- | ----------------- | ---------- |
|
|
68
|
-
| `react` | `^18.3.0` | | `@mui/material` | `^6.4.0` |
|
|
69
|
-
| `react-dom` | `^18.3.0` | | `@emotion/react` | `^11.11.0` |
|
|
70
|
-
| `@xyflow/react` | `^12.3.0` | | `@emotion/styled` | `^11.11.0` |
|
|
71
|
+
`yjs` and `y-protocols` are required for all builds; the React, MUI, emotion, and xyflow peers below are specific to the `/react` and `/external` builds.
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
| Peer | Range | | Peer | Range |
|
|
74
|
+
| ------------- | --------- | --- | ----------------- | ---------- |
|
|
75
|
+
| `yjs` | `^13.6.0` | | `@mui/material` | `^6.4.0` |
|
|
76
|
+
| `y-protocols` | `^1.0.6` | | `@emotion/react` | `^11.12.0` |
|
|
77
|
+
| `react` | `^19.0.0` | | `@emotion/styled` | `^11.12.0` |
|
|
78
|
+
| `react-dom` | `^19.0.0` | | `@xyflow/react` | `^12.9.0` |
|
|
79
|
+
|
|
80
|
+
### Fully external build (any bundler host)
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npm install @tumaet/apollon \
|
|
84
|
+
yjs y-protocols \
|
|
85
|
+
react react-dom \
|
|
86
|
+
@emotion/react @emotion/styled @mui/material @xyflow/react
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { ApollonEditor } from "@tumaet/apollon/external"
|
|
91
|
+
import "@tumaet/apollon/style.css"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Same imperative `ApollonEditor` API as the default entry, but **every** dependency is left external — the React family above _and_ Apollon's own runtime deps (`@dnd-kit`, `zustand`, `uuid`, `@chenglou/pretext`), which arrive transitively when you install the package. Your bundler then resolves and de-duplicates each one against your app's `node_modules`, and your bundle analyzer / SBOM tooling sees them as the real packages they are instead of code inlined invisibly into one chunk. Use this from any framework with a bundler — even a non-React one (the editor still runs on the React you provide internally; your own code never touches it).
|
|
73
95
|
|
|
74
|
-
|
|
96
|
+
## Which build do I use?
|
|
75
97
|
|
|
76
|
-
- **
|
|
77
|
-
- **A React app?** Use `@tumaet/apollon/react` and install the peers above. The default build bundles its own React, so in a React app you would load two copies
|
|
98
|
+
- **No bundler** (vanilla JS, `<script>`, CDN)? Use the default `@tumaet/apollon`. It inlines its own React, so the only peers to install are `yjs` and `y-protocols`.
|
|
99
|
+
- **A React app?** Use `@tumaet/apollon/react` and install the peers above. The default build bundles its own React, so in a React app you would load two copies — that causes "Invalid hook call" errors and a larger bundle. The `/react` subpath leaves React, MUI, emotion, and xyflow external so the editor shares the copies your app already has. It is also the only entry that exports the `<Apollon>` component, hooks, and provider.
|
|
100
|
+
- **A bundler host that wants one shared, fully auditable copy of every dependency?** Use `@tumaet/apollon/external` and install the peers above. Works from any framework.
|
|
78
101
|
|
|
79
102
|
> **⚠️ Give the container an explicit, non-zero height** (`600px`, `80vh`, or a sized flex/grid child), whichever build you use. The canvas sizes itself to its parent, so with no resolvable height it collapses to zero pixels and renders blank. This is the most common embedding mistake. See [Troubleshooting](https://ls1intum.github.io/Apollon/library/troubleshooting).
|
|
80
103
|
|
|
@@ -177,12 +200,14 @@ export class DiagramEditorComponent {
|
|
|
177
200
|
|
|
178
201
|
### Vanilla JS / CDN
|
|
179
202
|
|
|
203
|
+
`yjs` and `y-protocols` are required peers, but on the CDN path esm.sh resolves and serves them from the import URL automatically — there is nothing extra to load. (With a bundler you install the peers yourself.)
|
|
204
|
+
|
|
180
205
|
```html
|
|
181
|
-
<link rel="stylesheet" href="https://esm.sh/@tumaet/apollon@4.
|
|
206
|
+
<link rel="stylesheet" href="https://esm.sh/@tumaet/apollon@4.9.0/style.css" />
|
|
182
207
|
<div id="apollon" style="width: 100%; height: 600px"></div>
|
|
183
208
|
|
|
184
209
|
<script type="module">
|
|
185
|
-
import { ApollonEditor } from "https://esm.sh/@tumaet/apollon@4.
|
|
210
|
+
import { ApollonEditor } from "https://esm.sh/@tumaet/apollon@4.9.0"
|
|
186
211
|
|
|
187
212
|
const saved = localStorage.getItem("diagram")
|
|
188
213
|
const editor = new ApollonEditor(document.getElementById("apollon"), {
|