@tumaet/apollon 4.8.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.
Files changed (54) hide show
  1. package/README.md +45 -20
  2. package/dist/assets/style.css +1 -1
  3. package/dist/exportStyles-Co-WBqTa.js +5 -0
  4. package/dist/external/LICENSE-InterFont +92 -0
  5. package/dist/external/exportFonts-DxO9jrR1.js +19 -0
  6. package/dist/external/exportStyles-Co-WBqTa.js +5 -0
  7. package/dist/external/index.js +22191 -0
  8. package/dist/index.d.ts +131 -3
  9. package/dist/index.js +19744 -19098
  10. package/dist/internals.d.ts +29 -0
  11. package/dist/internals.js +7 -6
  12. package/dist/react/apollon-editor.d.ts +56 -3
  13. package/dist/react/components/CustomControls.d.ts +7 -0
  14. package/dist/react/components/popovers/PopoverManager.d.ts +1 -1
  15. package/dist/react/components/popovers/activityDiagram/ActivitySwimlaneEditPopover.d.ts +2 -0
  16. package/dist/react/components/popovers/activityDiagram/index.d.ts +1 -0
  17. package/dist/react/components/react/ApollonControl.d.ts +18 -0
  18. package/dist/react/components/svgs/nodes/InterfaceLabel.d.ts +26 -0
  19. package/dist/react/components/svgs/nodes/activityDiagram/ActivitySwimlaneSVG.d.ts +9 -0
  20. package/dist/react/components/svgs/nodes/activityDiagram/index.d.ts +1 -0
  21. package/dist/react/components/svgs/nodes/componentDiagram/ComponentInterfaceNodeSVG.d.ts +2 -0
  22. package/dist/react/components/svgs/nodes/deploymentDiagram/DeploymentInterfaceSVG.d.ts +2 -0
  23. package/dist/react/constants.d.ts +18 -0
  24. package/dist/react/edges/labelTypes/EdgeIncludeExtendLabel.d.ts +1 -4
  25. package/dist/react/edges/labelTypes/EdgeMiddleLabels.d.ts +7 -4
  26. package/dist/react/edges/labelTypes/EdgeMultipleLabels.d.ts +2 -3
  27. package/dist/react/edges/labelTypes/messageLayout.d.ts +51 -0
  28. package/dist/react/exportStyles-yVX7Dykt.js +6 -0
  29. package/dist/react/hooks/index.d.ts +0 -1
  30. package/dist/react/hooks/useStepPathEdge.d.ts +11 -0
  31. package/dist/react/index.d.ts +1 -0
  32. package/dist/react/nodes/activityDiagram/ActivitySwimlane.d.ts +3 -0
  33. package/dist/react/nodes/activityDiagram/index.d.ts +1 -0
  34. package/dist/react/nodes/types.d.ts +2 -1
  35. package/dist/react/overlay/OverlayLayer.d.ts +8 -0
  36. package/dist/react/overlay/RegionMount.d.ts +10 -0
  37. package/dist/react/overlay/overlayStore.d.ts +20 -0
  38. package/dist/react/overlay/types.d.ts +48 -0
  39. package/dist/react/react.d.ts +1 -0
  40. package/dist/react/react.js +13264 -18536
  41. package/dist/react/store/context.d.ts +3 -0
  42. package/dist/react/types/nodes/NodeProps.d.ts +24 -0
  43. package/dist/react/utils/geometry/edgeLabelLayout.d.ts +123 -0
  44. package/dist/react/utils/geometry/interfaceLabelLayout.d.ts +44 -0
  45. package/dist/react/utils/index.d.ts +1 -0
  46. package/dist/react/utils/paletteLayout.d.ts +23 -19
  47. package/dist/react/utils/swimlaneUtils.d.ts +58 -0
  48. package/dist/yjsSync-BCNFF_EI.js +45418 -0
  49. package/package.json +19 -8
  50. package/schema/uml-model-4.schema.json +1 -0
  51. package/dist/exportStyles-Wcc8N8Xj.js +0 -5
  52. package/dist/react/exportStyles-CH2hautV.js +0 -6
  53. package/dist/react/hooks/useMessagePositioning.d.ts +0 -30
  54. package/dist/yjsSync-CqmgRwRE.js +0 -51038
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 two builds with the same API. Pick one based on whether your host already uses React:
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 | React / MUI / emotion / xyflow | Size (min / gzip) | Use when |
34
- | ----------------------------- | ------------------------------ | ----------------- | ------------------------------------------------------------------------------------------------------- |
35
- | `@tumaet/apollon` _(default)_ | **bundled** | ~2.4 MB / ~540 KB | Your host is Angular, Vue, Svelte, or vanilla JS. No peer deps to install. |
36
- | `@tumaet/apollon/react` | **peer deps** (shared) | ~875 KB / ~170 KB | Your host is React 18.3 and should share its React and MUI with the editor instead of duplicating them. |
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` number excludes the peers your app already ships.
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
- ### Standalone build (any framework, no peer deps)
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. Nothing else to install.
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
- | Peer | Range | | Peer | Range |
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
- ## Which build do I use?
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
- It comes down to whether your host already runs React:
96
+ ## Which build do I use?
75
97
 
76
- - **Not a React app?** Use the default `@tumaet/apollon`. It bundles its own React, so there is nothing extra to install or configure.
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. 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.
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.8.0/style.css" />
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.8.0"
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"), {