@tumaet/apollon 4.6.0 → 4.7.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 (157) hide show
  1. package/README.md +2 -2
  2. package/dist/LICENSE-InterFont +92 -0
  3. package/dist/assets/style.css +1 -1
  4. package/dist/exportFonts-DxO9jrR1.js +19 -0
  5. package/dist/exportStyles-Xk-Vm7Ul.js +5 -0
  6. package/dist/index.d.ts +132 -92
  7. package/dist/index.js +34822 -8034
  8. package/dist/internals.d.ts +100 -92
  9. package/dist/internals.js +15 -10
  10. package/dist/react/App.d.ts +1 -1
  11. package/dist/react/LICENSE-InterFont +92 -0
  12. package/dist/react/apollon-editor.d.ts +19 -0
  13. package/dist/react/components/AlignmentGuides.d.ts +1 -1
  14. package/dist/react/components/AssessmentSelectionDebug.d.ts +1 -1
  15. package/dist/react/components/CustomBackground.d.ts +1 -1
  16. package/dist/react/components/CustomControls.d.ts +1 -1
  17. package/dist/react/components/CustomMiniMap.d.ts +1 -1
  18. package/dist/react/components/Icon/ArrowBackIcon.d.ts +1 -1
  19. package/dist/react/components/Icon/ArrowForwardIcon.d.ts +1 -1
  20. package/dist/react/components/Icon/CheckIcon.d.ts +1 -1
  21. package/dist/react/components/Icon/CrossIcon.d.ts +1 -1
  22. package/dist/react/components/Icon/DeleteIcon.d.ts +1 -1
  23. package/dist/react/components/Icon/DragHandleIcon.d.ts +1 -1
  24. package/dist/react/components/Icon/EditIcon.d.ts +1 -1
  25. package/dist/react/components/Icon/ExclamationIcon.d.ts +1 -1
  26. package/dist/react/components/Icon/InfiniteIcon.d.ts +1 -1
  27. package/dist/react/components/Icon/MapIcon.d.ts +1 -1
  28. package/dist/react/components/Icon/PaintRollerIcon.d.ts +1 -1
  29. package/dist/react/components/Icon/RedoIcon.d.ts +1 -1
  30. package/dist/react/components/Icon/SouthEastArrowIcon.d.ts +1 -1
  31. package/dist/react/components/Icon/SwapHorizIcon.d.ts +1 -1
  32. package/dist/react/components/Icon/UndoIcon.d.ts +1 -1
  33. package/dist/react/components/ReconnectConnectionLine.d.ts +1 -1
  34. package/dist/react/components/Sidebar.d.ts +2 -1
  35. package/dist/react/components/collaboration/CollaborationLayer.d.ts +1 -1
  36. package/dist/react/components/popovers/DefaultNodeGiveFeedbackPopover.d.ts +1 -1
  37. package/dist/react/components/popovers/DefaultNodeSeeFeedbackPopover.d.ts +1 -1
  38. package/dist/react/components/popovers/GenericPopover.d.ts +1 -1
  39. package/dist/react/components/popovers/GiveFeedbackAssessmentBox.d.ts +1 -1
  40. package/dist/react/components/popovers/PopoverManager.d.ts +2 -2
  41. package/dist/react/components/popovers/SeeFeedbackAssessmentBox.d.ts +1 -1
  42. package/dist/react/components/popovers/bpmnDiagram/BPMNPoolEditPopover.d.ts +1 -1
  43. package/dist/react/components/popovers/classDiagram/ClassGiveFeedbackPopover.d.ts +1 -1
  44. package/dist/react/components/popovers/classDiagram/ClassSeeFeedbackPopover.d.ts +1 -1
  45. package/dist/react/components/popovers/communicationDiagram/CommunicationObjectNameGiveFeedbackPopover.d.ts +1 -1
  46. package/dist/react/components/popovers/communicationDiagram/CommunicationObjectNameSeeFeedbackPopover.d.ts +1 -1
  47. package/dist/react/components/popovers/edgePopovers/EdgeGiveFeedbackPopover.d.ts +1 -1
  48. package/dist/react/components/popovers/edgePopovers/EdgeSeeFeedbackPopover.d.ts +1 -1
  49. package/dist/react/components/popovers/edgePopovers/EdgeTypePreviewIcon.d.ts +1 -1
  50. package/dist/react/components/popovers/edgePopovers/EdgeTypeSelect.d.ts +1 -1
  51. package/dist/react/components/popovers/edgePopovers/SwapEndsButton.d.ts +9 -0
  52. package/dist/react/components/popovers/objectDiagram/ObjectGiveFeedbackPopover.d.ts +1 -1
  53. package/dist/react/components/popovers/objectDiagram/ObjectSeeFeedbackPopover.d.ts +1 -1
  54. package/dist/react/components/react/Apollon.d.ts +7 -2
  55. package/dist/react/components/react/context.d.ts +1 -1
  56. package/dist/react/components/svgs/edges/InlineMarker.d.ts +2 -2
  57. package/dist/react/components/svgs/nodes/classDiagram/ClassSVG.d.ts +1 -1
  58. package/dist/react/components/svgs/nodes/classDiagram/ColorDescriptionSVG.d.ts +1 -1
  59. package/dist/react/components/svgs/nodes/communicationDiagram/CommunicationObjectNameSVG.d.ts +1 -1
  60. package/dist/react/components/svgs/nodes/objectDiagram/ObjectNameSVG.d.ts +1 -1
  61. package/dist/react/components/toolbars/edgeToolBar/CustomEdgeToolBar.d.ts +1 -1
  62. package/dist/react/components/ui/StyleEditor/ColorButtons.d.ts +1 -1
  63. package/dist/react/constants.d.ts +7 -6
  64. package/dist/react/edges/GenericEdge.d.ts +5 -6
  65. package/dist/react/edges/edgeTypes/ActivityDiagramEdge.d.ts +1 -1
  66. package/dist/react/edges/edgeTypes/BPMNDiagramEdge.d.ts +1 -1
  67. package/dist/react/edges/edgeTypes/ClassDiagramEdge.d.ts +1 -1
  68. package/dist/react/edges/edgeTypes/CommunicationDiagramEdge.d.ts +1 -1
  69. package/dist/react/edges/edgeTypes/ComponentDiagramEdge.d.ts +1 -1
  70. package/dist/react/edges/edgeTypes/DeploymentDiagramEdge.d.ts +1 -1
  71. package/dist/react/edges/edgeTypes/FlowChartEdge.d.ts +1 -1
  72. package/dist/react/edges/edgeTypes/ObjectDiagramEdge.d.ts +1 -1
  73. package/dist/react/edges/edgeTypes/PetriNetEdge.d.ts +1 -1
  74. package/dist/react/edges/edgeTypes/ReachabilityGraphArc.d.ts +1 -1
  75. package/dist/react/edges/edgeTypes/SfcDiagramEdge.d.ts +1 -1
  76. package/dist/react/edges/edgeTypes/SyntaxTreeEdge.d.ts +1 -1
  77. package/dist/react/edges/edgeTypes/UseCaseDiagramEdge.d.ts +1 -1
  78. package/dist/react/edges/labelTypes/EdgeEndLabels.d.ts +1 -1
  79. package/dist/react/edges/labelTypes/EdgeIncludeExtendLabel.d.ts +1 -1
  80. package/dist/react/edges/labelTypes/EdgeMiddleLabels.d.ts +1 -1
  81. package/dist/react/edges/labelTypes/EdgeMultipleLabels.d.ts +1 -1
  82. package/dist/react/edges/types.d.ts +34 -34
  83. package/dist/react/exportFonts-DSRUaduf.js +20 -0
  84. package/dist/react/exportStyles-DZCHk5mK.js +6 -0
  85. package/dist/react/fontStack.d.ts +14 -0
  86. package/dist/react/hooks/index.d.ts +1 -0
  87. package/dist/react/hooks/useEdgeLineJumps.d.ts +3 -1
  88. package/dist/react/hooks/useEdgeToolbar.d.ts +1 -1
  89. package/dist/react/hooks/usePopoverAnchor.d.ts +26 -0
  90. package/dist/react/hooks/useReactiveElement.d.ts +10 -0
  91. package/dist/react/hooks/useStepPathEdge.d.ts +1 -1
  92. package/dist/react/hooks/useStraightPathEdge.d.ts +1 -1
  93. package/dist/react/index.d.ts +1 -0
  94. package/dist/react/nodes/TitleAndDescriptionNode.d.ts +1 -1
  95. package/dist/react/nodes/activityDiagram/Activity.d.ts +1 -1
  96. package/dist/react/nodes/activityDiagram/ActivityActionNode.d.ts +1 -1
  97. package/dist/react/nodes/activityDiagram/ActivityFinalNode.d.ts +1 -1
  98. package/dist/react/nodes/activityDiagram/ActivityForkNode.d.ts +1 -1
  99. package/dist/react/nodes/activityDiagram/ActivityForkNodeHorizontal.d.ts +1 -1
  100. package/dist/react/nodes/activityDiagram/ActivityInitialNode.d.ts +1 -1
  101. package/dist/react/nodes/activityDiagram/ActivityMergeNode.d.ts +1 -1
  102. package/dist/react/nodes/activityDiagram/ActivityObjectNode.d.ts +1 -1
  103. package/dist/react/nodes/bpmn/BPMNAnnotation.d.ts +1 -1
  104. package/dist/react/nodes/bpmn/BPMNCallActivity.d.ts +1 -1
  105. package/dist/react/nodes/bpmn/BPMNDataObject.d.ts +1 -1
  106. package/dist/react/nodes/bpmn/BPMNDataStore.d.ts +1 -1
  107. package/dist/react/nodes/bpmn/BPMNEndEvent.d.ts +1 -1
  108. package/dist/react/nodes/bpmn/BPMNGateway.d.ts +1 -1
  109. package/dist/react/nodes/bpmn/BPMNGroup.d.ts +1 -1
  110. package/dist/react/nodes/bpmn/BPMNIntermediateEvent.d.ts +1 -1
  111. package/dist/react/nodes/bpmn/BPMNPool.d.ts +1 -1
  112. package/dist/react/nodes/bpmn/BPMNStartEvent.d.ts +1 -1
  113. package/dist/react/nodes/bpmn/BPMNSubprocess.d.ts +1 -1
  114. package/dist/react/nodes/bpmn/BPMNTask.d.ts +1 -1
  115. package/dist/react/nodes/bpmn/BPMNTransaction.d.ts +1 -1
  116. package/dist/react/nodes/classDiagram/Class.d.ts +1 -1
  117. package/dist/react/nodes/classDiagram/ColorDescription.d.ts +1 -1
  118. package/dist/react/nodes/classDiagram/Package.d.ts +1 -1
  119. package/dist/react/nodes/communicationDiagram/CommunicationObjectName.d.ts +1 -1
  120. package/dist/react/nodes/componentDiagram/Component.d.ts +1 -1
  121. package/dist/react/nodes/componentDiagram/ComponentInterface.d.ts +1 -1
  122. package/dist/react/nodes/componentDiagram/ComponentSubsystem.d.ts +1 -1
  123. package/dist/react/nodes/deploymentDiagram/DeploymentArtifact.d.ts +1 -1
  124. package/dist/react/nodes/deploymentDiagram/DeploymentComponent.d.ts +1 -1
  125. package/dist/react/nodes/deploymentDiagram/DeploymentInterface.d.ts +1 -1
  126. package/dist/react/nodes/deploymentDiagram/DeploymentNode.d.ts +1 -1
  127. package/dist/react/nodes/flowchart/FlowchartDecision.d.ts +1 -1
  128. package/dist/react/nodes/flowchart/FlowchartFunctionCall.d.ts +1 -1
  129. package/dist/react/nodes/flowchart/FlowchartInputOutput.d.ts +1 -1
  130. package/dist/react/nodes/flowchart/FlowchartProcess.d.ts +1 -1
  131. package/dist/react/nodes/flowchart/FlowchartTerminal.d.ts +1 -1
  132. package/dist/react/nodes/objectDiagram/ObjectName.d.ts +1 -1
  133. package/dist/react/nodes/petriNetDiagram/PetriNetPlace.d.ts +1 -1
  134. package/dist/react/nodes/petriNetDiagram/PetriNetTransition.d.ts +1 -1
  135. package/dist/react/nodes/reachabilityGraphDiagram/ReachabilityGraphMarking.d.ts +1 -1
  136. package/dist/react/nodes/sfcDiagram/SfcActionTable.d.ts +1 -1
  137. package/dist/react/nodes/sfcDiagram/SfcJump.d.ts +1 -1
  138. package/dist/react/nodes/sfcDiagram/SfcStart.d.ts +1 -1
  139. package/dist/react/nodes/sfcDiagram/SfcStep.d.ts +1 -1
  140. package/dist/react/nodes/sfcDiagram/SfcTransitionBranch.d.ts +1 -1
  141. package/dist/react/nodes/syntaxTreeDiagram/SyntaxTreeNonterminal.d.ts +1 -1
  142. package/dist/react/nodes/syntaxTreeDiagram/SyntaxTreeTerminal.d.ts +1 -1
  143. package/dist/react/nodes/useCaseDiagram/UseCase.d.ts +1 -1
  144. package/dist/react/nodes/useCaseDiagram/UseCaseActor.d.ts +1 -1
  145. package/dist/react/nodes/useCaseDiagram/UseCaseSystem.d.ts +1 -1
  146. package/dist/react/nodes/wrappers/DefaultNodeWrapper.d.ts +1 -1
  147. package/dist/react/react.js +23428 -24886
  148. package/dist/react/store/assessmentSelectionStore.d.ts +2 -0
  149. package/dist/react/types/nodes/NodeProps.d.ts +3 -3
  150. package/dist/react/typings.d.ts +6 -2
  151. package/dist/react/utils/exportFonts.d.ts +11 -0
  152. package/dist/react/utils/exportStyles.d.ts +30 -0
  153. package/dist/react/utils/exportUtils.d.ts +31 -1
  154. package/dist/yjsSync-aPxjWNdZ.js +50939 -0
  155. package/package.json +24 -16
  156. package/schema/uml-model-4.schema.json +363 -0
  157. package/dist/yjsSync-CK5cmd5z.js +0 -71308
@@ -3,11 +3,13 @@ export type AssessmentSelectionStore = {
3
3
  selectedElementIds: string[];
4
4
  highlightedElementId: string | null;
5
5
  isAssessmentSelectionMode: boolean;
6
+ highlightedElements: Record<string, string>;
6
7
  setAssessmentSelectionMode: (isActive: boolean) => void;
7
8
  selectElement: (elementId: string) => void;
8
9
  selectMultipleElements: (elementIds: string[]) => void;
9
10
  clearSelection: () => void;
10
11
  setHighlightedElement: (elementId: string | null) => void;
12
+ setElementHighlights: (highlights: Record<string, string>) => void;
11
13
  isElementSelected: (elementId: string) => boolean;
12
14
  isElementHighlighted: (elementId: string) => boolean;
13
15
  reset: () => void;
@@ -36,7 +36,7 @@ export type DeploymentComponentProps = {
36
36
  } & DefaultNodeProps;
37
37
  export type PetriNetPlaceProps = {
38
38
  tokens: number;
39
- capacity: number | "Infinity";
39
+ capacity: number | string;
40
40
  } & DefaultNodeProps;
41
41
  export type BPMNTaskType = "default" | "user" | "send" | "receive" | "manual" | "business-rule" | "script";
42
42
  export type BPMNMarkerType = "none" | "parallel multi instance" | "sequential multi instance" | "loop";
@@ -48,7 +48,7 @@ export type BPMNStartEventType = "default" | "message" | "timer" | "conditional"
48
48
  export type BPMNIntermediateEventType = "default" | "message-catch" | "message-throw" | "timer-catch" | "escalation-throw" | "conditional-catch" | "link-catch" | "link-throw" | "compensation-throw" | "signal-catch" | "signal-throw";
49
49
  export type BPMNEndEventType = "default" | "message" | "escalation" | "error" | "compensation" | "signal" | "terminate";
50
50
  export type BPMNEventProps = DefaultNodeProps & {
51
- eventType: BPMNStartEventType;
51
+ eventType: BPMNStartEventType | BPMNIntermediateEventType | BPMNEndEventType;
52
52
  };
53
53
  export type BPMNGatewayType = "complex" | "event-based" | "exclusive" | "inclusive" | "parallel";
54
54
  export type BPMNGatewayProps = DefaultNodeProps & {
@@ -73,5 +73,5 @@ export type SfcActionTableProps = DefaultNodeProps & {
73
73
  actionRows: SfcActionRow[];
74
74
  };
75
75
  export type SfcTransitionBranchNodeProps = DefaultNodeProps & {
76
- showHint: boolean;
76
+ showHint?: boolean;
77
77
  };
@@ -88,8 +88,12 @@ export type ApollonEdge = {
88
88
  data: OrthogonalEdgeData;
89
89
  };
90
90
  export type InteractiveElements = {
91
- elements: Record<string, boolean>;
92
- relationships: Record<string, boolean>;
91
+ elements: {
92
+ [id: string]: boolean;
93
+ };
94
+ relationships: {
95
+ [id: string]: boolean;
96
+ };
93
97
  };
94
98
  export type UMLModel = {
95
99
  version: `4.${number}.${number}`;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Inter `@font-face` (base64 woff2) for self-contained `compat`-mode SVG
3
+ * exports, so the file renders in Inter when opened away from the editor
4
+ * (browser, Inkscape, PowerPoint). The woff2 is the same file `fonts.css`
5
+ * bundles. resvg does not resolve data-URI `@font-face` (resvg#541) — pass the
6
+ * font via its `fontFiles` instead; the embedded face is harmlessly ignored.
7
+ *
8
+ * Data-only and loaded lazily (dynamic `import()` in `exportModelAsSvg`) so the
9
+ * woff2 lands in its own chunk instead of the main bundle.
10
+ */
11
+ export declare const INTER_FONT_FACE_CSS: string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Layout CSS the off-screen export mount needs to be self-contained, so a
3
+ * consumer rendering headlessly never has to import `@tumaet/apollon/style.css`
4
+ * for the export to be correct.
5
+ *
6
+ * The load-bearing rule is React Flow's `base.css` `.react-flow__node {
7
+ * position: absolute }`: Apollon positions each connection `<Handle>` with an
8
+ * inline `left/top: "X%"` (see `DefaultNodeWrapper`), and a percentage offset
9
+ * resolves against the nearest *positioned* ancestor. React Flow sets the
10
+ * node's transform/size inline but not `position` — that comes only from
11
+ * `base.css`. Without it `.react-flow__node` is `position: static`, the handle
12
+ * `%` offsets resolve against the wrong box, React Flow's on-mount
13
+ * `getBoundingClientRect` handle measurement is wrong, and edges route through
14
+ * the node boxes (the symptom reported for browser/Playwright exports). The
15
+ * same `base.css` also positions `.react-flow__viewport/.react-flow__edges`,
16
+ * which the `getBoundingClientRect`-based bounds math in `exportUtils` relies on.
17
+ *
18
+ * `app.css` adds `.apollon-canvas { flex: 1; ... }` so the canvas fills the
19
+ * 4000×4000 mount container.
20
+ *
21
+ * WARNING: `app.css` is inlined verbatim into this lazy chunk. It must stay
22
+ * free of `@font-face`, `url(...)`, and `@import`, or those assets leak into
23
+ * this chunk (the Inter font is shipped separately, see `exportFonts.ts`).
24
+ *
25
+ * Reached only via a dynamic `import()` in `exportModelAsSvg`, so Rollup emits
26
+ * it as its own chunk and these ~26 KB of CSS-as-string stay out of the main
27
+ * bundle (mirrors the `exportFonts.ts` pattern). The chunk is emitted per build
28
+ * entry (`dist/` and `dist/react/`).
29
+ */
30
+ export declare const EXPORT_LAYOUT_CSS: string;
@@ -7,7 +7,7 @@ type ExportFilterOptions = {
7
7
  svgMode?: SvgExportMode;
8
8
  };
9
9
  export declare function filterRenderedElements(container: HTMLElement, options?: ExportFilterOptions): void;
10
- export declare const getSVG: (container: HTMLElement, clip: Rect, options?: ExportFilterOptions) => string;
10
+ export declare const getSVG: (container: HTMLElement, clip: Rect, options?: ExportFilterOptions, fontFaceCss?: string) => string;
11
11
  /**
12
12
  * Extract all coordinate points from an SVG path string.
13
13
  * This includes endpoints AND control points for bezier curves,
@@ -72,6 +72,25 @@ declare function convertStyleToAttributes(node: Element | ChildNode): void;
72
72
  * from inline styles are present as attributes.
73
73
  */
74
74
  declare function ensureTextFontDefaults(svg: Element): void;
75
+ /**
76
+ * Resolve relative `font-size` (`%`, `em`) to px against the inherited size —
77
+ * otherwise stereotypes (`font-size="85%"`) balloon over the class title. Walks
78
+ * depth-first carrying the resolved px; runs after ensureTextFontDefaults so
79
+ * every <text> already has a px size to inherit.
80
+ */
81
+ declare function resolveRelativeFontSizes(el: Element, inheritedPx?: number): void;
82
+ /**
83
+ * Flatten cumulative `<tspan dy>` to absolute `y` — Skia collapses sibling
84
+ * tspans onto one line, overlapping a stereotype with its class name. Assumes
85
+ * the flat `<text><tspan/></text>` shape Apollon emits (no nested tspans).
86
+ */
87
+ declare function resolveTspanDy(svg: Element): void;
88
+ /**
89
+ * Resolve `dominant-baseline` to an explicit baseline `y` — non-browser engines
90
+ * draw every label at the alphabetic baseline (too high) otherwise. Runs after
91
+ * resolveTspanDy so tspan `y` is already absolute.
92
+ */
93
+ declare function resolveDominantBaseline(svg: Element): void;
75
94
  /**
76
95
  * Replace `text-decoration="underline"` on `<text>` elements with manual
77
96
  * `<line>` siblings so the underline is visible in non-browser renderers.
@@ -85,6 +104,13 @@ declare function ensureTextFontDefaults(svg: Element): void;
85
104
  * The SVG must be temporarily attached to the DOM for `getBBox()` to work.
86
105
  */
87
106
  declare function replaceTextDecorationWithManualUnderline(svg: SVGSVGElement): void;
107
+ /**
108
+ * Embed `@font-face` CSS (typically the bundled Inter woff2 as base64) into the
109
+ * export SVG so the document carries its own font and renders identically when
110
+ * opened away from the editor. Inserted first so the face is declared before
111
+ * any `<text>` references it. Idempotent: a second call is a no-op.
112
+ */
113
+ declare function embedFontFaceCss(svg: SVGSVGElement, css: string): void;
88
114
  /**
89
115
  * Final safety pass: strip any legacy <marker> references that could sneak in
90
116
  * from third-party content. Keeps exports clean for PowerPoint/Keynote.
@@ -94,6 +120,7 @@ declare function removeMarkerElements(svg: Element): void;
94
120
  * @internal — Exported for unit testing only. Not part of the public API.
95
121
  */
96
122
  export declare const __testing: {
123
+ readonly embedFontFaceCss: typeof embedFontFaceCss;
97
124
  readonly filterRenderedElements: typeof filterRenderedElements;
98
125
  readonly getRenderedDiagramBounds: typeof getRenderedDiagramBounds;
99
126
  readonly extractPathPoints: typeof extractPathPoints;
@@ -102,6 +129,9 @@ export declare const __testing: {
102
129
  readonly replaceCSSVariables: typeof replaceCSSVariables;
103
130
  readonly convertStyleToAttributes: typeof convertStyleToAttributes;
104
131
  readonly ensureTextFontDefaults: typeof ensureTextFontDefaults;
132
+ readonly resolveRelativeFontSizes: typeof resolveRelativeFontSizes;
133
+ readonly resolveTspanDy: typeof resolveTspanDy;
134
+ readonly resolveDominantBaseline: typeof resolveDominantBaseline;
105
135
  readonly removeMarkerElements: typeof removeMarkerElements;
106
136
  readonly replaceTextDecorationWithManualUnderline: typeof replaceTextDecorationWithManualUnderline;
107
137
  readonly mergeBounds: typeof mergeBounds;