@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/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { Edge } from '@xyflow/react';
2
3
  import { EdgeProps } from '@xyflow/react';
3
4
  import { JSX } from 'react';
4
5
  import { Node as Node_2 } from '@xyflow/react';
5
6
  import { NodeProps } from '@xyflow/react';
7
+ import { ReactNode } from 'react';
6
8
  import { XYPosition } from '@xyflow/react';
7
9
 
8
10
  declare function Activity({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;
@@ -21,6 +23,21 @@ declare function ActivityMergeNode({ id, width, height, data, parentId, }: NodeP
21
23
 
22
24
  declare function ActivityObjectNode({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;
23
25
 
26
+ declare function ActivitySwimlane({ id, width, height, data, parentId, }: NodeProps<Node_2<ActivitySwimlaneProps>>): JSX.Element | null;
27
+
28
+ /**
29
+ * Activity-partition (swimlane) container. Lanes are equal divisions along the
30
+ * primary axis (columns when vertical, rows when horizontal). Elements dropped
31
+ * into the swimlane become its children and move with it; which lane an element
32
+ * belongs to is expressed by where the modeller places it, matching the UML
33
+ * activity-partition notation where partition membership is positional rather
34
+ * than stored per element.
35
+ */
36
+ declare type ActivitySwimlaneProps = DefaultNodeProps & {
37
+ orientation: "vertical" | "horizontal";
38
+ lanes: SwimlaneLane[];
39
+ };
40
+
24
41
  declare namespace Apollon {
25
42
  export {
26
43
  UMLDiagramType,
@@ -82,8 +99,8 @@ export declare class ApollonEditor {
82
99
  private readonly metadataStore;
83
100
  private readonly popoverStore;
84
101
  private readonly assessmentSelectionStore;
85
- private readonly alignmentGuidesStore;
86
- private readonly edgeGeometryStore;
102
+ private readonly overlayStore;
103
+ private readonly hostRegionEls;
87
104
  private subscribers;
88
105
  constructor(element: HTMLElement, options?: Apollon.ApollonOptions);
89
106
  private setReactFlowInstance;
@@ -102,10 +119,62 @@ export declare class ApollonEditor {
102
119
  x: number;
103
120
  y: number;
104
121
  }): XYPosition | null;
122
+ /**
123
+ * Zoom/pan so the whole diagram fits, capped at `maxZoom: 1.0`. Retries up to
124
+ * 10 animation frames until every node is measured.
125
+ * @param options.padding - Scalar fraction (default `0.15`), or per-side px
126
+ * that adds to a 16px gutter. A per-side object forces the inset-aware path.
127
+ * @param options.duration - Animation duration in ms (default `200`).
128
+ * @param options.respectInsets - Pad the fit by reserved overlay insets
129
+ * (header, rails, …). Default `true`.
130
+ */
105
131
  fitView(options?: {
106
- padding?: number;
132
+ padding?: number | Partial<Record<OverlaySide, number>>;
107
133
  duration?: number;
134
+ /** Pad the fit by the reserved overlay insets (header, rails, …). */
135
+ respectInsets?: boolean;
108
136
  }): void;
137
+ /**
138
+ * Register a floating control, returning a disposer. Re-using an id replaces
139
+ * (idempotent / StrictMode-safe). Pick a façade: a React host →
140
+ * `<ApollonControl>`; a non-React host (or one that needs its own React
141
+ * root/context) → `getRegionElement` + `createPortal`; a one-off imperative
142
+ * widget → `addControl`.
143
+ * @param control - id, target region, a `render` thunk, and optional layout
144
+ * options ({@link OverlayControlInput}).
145
+ * @returns A disposer that unregisters this control; safe to call twice.
146
+ * @throws If `id` is empty or `region` is not a known region — mistakes fail
147
+ * loudly at the edge, not silently in the renderer.
148
+ */
149
+ addControl(control: OverlayControlInput): () => void;
150
+ /**
151
+ * Patch a registered control's options/renderer (a no-op if absent).
152
+ * @param id - The control's immutable id (an `id` in `patch` is ignored).
153
+ * @param patch - Partial options/renderer merged over the existing control.
154
+ */
155
+ updateControl(id: string, patch: Partial<OverlayControlInput>): void;
156
+ /**
157
+ * @param id - A control id.
158
+ * @returns `true` if a control with this id is currently registered.
159
+ */
160
+ hasControl(id: string): boolean;
161
+ /**
162
+ * A stable DOM node anchored in `region`, for hosts that render their own
163
+ * React into it (via `createPortal`) to keep host context. Auto-measured, so
164
+ * the diagram makes room for whatever the host mounts. Lifetime = the editor;
165
+ * `releaseRegionElement` unregisters it. Reserved id: `apollon:host:<region>`.
166
+ * @param region - The region to anchor the node in.
167
+ * @returns The same node for the lifetime of one acquire; `releaseRegionElement`
168
+ * drops it and the next call returns a fresh node.
169
+ * @throws If `region` is not a known region.
170
+ */
171
+ getRegionElement(region: OverlayRegion): HTMLElement;
172
+ /**
173
+ * Release a region acquired via {@link getRegionElement} (unregister + drop
174
+ * the cached node); a later `getRegionElement(region)` creates a fresh node.
175
+ * @param region - The region whose host node to release.
176
+ */
177
+ releaseRegionElement(region: OverlayRegion): void;
109
178
  set diagramType(type: UMLDiagramType);
110
179
  destroy(): void;
111
180
  /** Renders a model to SVG via a hidden, off-screen mount. */
@@ -529,6 +598,7 @@ declare const diagramNodeTypes: {
529
598
  activityMergeNode: typeof ActivityMergeNode;
530
599
  activityForkNode: typeof ActivityForkNode;
531
600
  activityForkNodeHorizontal: typeof ActivityForkNodeHorizontal;
601
+ activitySwimlane: typeof ActivitySwimlane;
532
602
  useCase: typeof UseCase;
533
603
  useCaseActor: typeof UseCaseActor;
534
604
  useCaseSystem: typeof UseCaseSystem;
@@ -653,6 +723,14 @@ export declare const getNodeAssessmentDataByNodeElementId: (nodeElementId: strin
653
723
  */
654
724
  export declare function importDiagram(data: any | V3UMLModel): UMLModel;
655
725
 
726
+ /**
727
+ * How much room a control reserves so the diagram "makes way" (fed into
728
+ * `fitView` padding, MapLibre-style). `"auto"` measures the control via the
729
+ * shared ResizeObserver on the region's dominant axis; an object mixes explicit
730
+ * px with per-side `"auto"` (e.g. `{ top: "auto" }`).
731
+ */
732
+ export declare type InsetContribution = "auto" | Partial<Record<OverlaySide, number | "auto">>;
733
+
656
734
  export declare type InteractiveElements = {
657
735
  elements: {
658
736
  [id: string]: boolean;
@@ -703,6 +781,43 @@ export declare interface OrthogonalEdgeData {
703
781
  points: IPoint_2[];
704
782
  }
705
783
 
784
+ /** The public registration payload (options + renderer). */
785
+ export declare type OverlayControlInput = OverlayControlOptions & {
786
+ render: () => ReactNode;
787
+ };
788
+
789
+ export declare interface OverlayControlOptions {
790
+ /** Stable id. Re-adding the same id REPLACES (idempotent, StrictMode-safe). */
791
+ id: string;
792
+ /** Which band/corner the control is anchored in. */
793
+ region: OverlayRegion;
794
+ /** Reserve viewport room. Default: reserves nothing (the control floats). */
795
+ inset?: InsetContribution;
796
+ /** Stacking within a region; lower renders toward the region's anchor edge. */
797
+ order?: number;
798
+ /** When false the region frame stays pointer-transparent here too. Default true. */
799
+ interactive?: boolean;
800
+ /** Wraps the control in a `role="group"` with this aria-label. No focus
801
+ * management is imposed. */
802
+ groupLabel?: string;
803
+ /** Hide without unregistering (reserves no inset while hidden). Default true. */
804
+ visible?: boolean;
805
+ /** Extra class on the control's wrapper element. */
806
+ className?: string;
807
+ /** Inline styles merged onto the control's wrapper element. */
808
+ style?: CSSProperties;
809
+ }
810
+
811
+ /**
812
+ * Where a control is anchored. The six React Flow `<Panel>` corners are
813
+ * screen-space and rendered through React Flow; `header`/`left-rail`/`right-rail`
814
+ * are library-owned bands; `on-canvas` pans/zooms with the diagram.
815
+ */
816
+ export declare type OverlayRegion = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "header" | "left-rail" | "right-rail" | "on-canvas";
817
+
818
+ /** One of the four edges a control can sit against / reserve room on. */
819
+ export declare type OverlaySide = "top" | "right" | "bottom" | "left";
820
+
706
821
  declare function Package({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;
707
822
 
708
823
  declare function PetriNetPlace({ id, width, height, data, }: NodeProps<Node_2<PetriNetPlaceProps>>): JSX.Element | null;
@@ -776,6 +891,19 @@ export declare type SVG = {
776
891
 
777
892
  export declare type SvgExportMode = "web" | "compat";
778
893
 
894
+ /** A single partition (lane) inside an activity swimlane. */
895
+ declare type SwimlaneLane = {
896
+ id: string;
897
+ name: string;
898
+ /**
899
+ * Lane's extent along the swimlane's primary axis, in absolute flow px. The
900
+ * last lane is elastic (fills the remainder), so resizing the swimlane only
901
+ * changes the last lane. Optional: lanes without it divide the space equally,
902
+ * so existing saved swimlanes render as equal lanes until a separator moves.
903
+ */
904
+ size?: number;
905
+ };
906
+
779
907
  declare function SyntaxTreeNonterminal({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;
780
908
 
781
909
  declare function SyntaxTreeTerminal({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;