@tumaet/apollon 5.0.1 → 5.1.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.
@@ -5,6 +5,7 @@ import { Node as Node_2 } from '@xyflow/react';
5
5
  import { NodeProps } from '@xyflow/react';
6
6
  import { OnEdgesChange } from '@xyflow/react';
7
7
  import { OnNodesChange } from '@xyflow/react';
8
+ import { Position } from '@xyflow/react';
8
9
  import { StoreApi } from 'zustand';
9
10
  import * as Y from 'yjs';
10
11
 
@@ -49,6 +50,215 @@ declare type ApollonEdge = {
49
50
  data: OrthogonalEdgeData;
50
51
  };
51
52
 
53
+ /**
54
+ * Flat, typed dictionary of the strings the editor renders itself. The library
55
+ * ships English defaults; a host overrides any subset via `labels` (a shallow,
56
+ * per-key merge). Strings that interpolate are functions so a translation keeps
57
+ * control of word order.
58
+ */
59
+ declare interface ApollonLabels {
60
+ zoomToolbar: string;
61
+ zoomIn: string;
62
+ zoomOut: string;
63
+ fitView: string;
64
+ /** Tooltip on the % readout button. */
65
+ resetZoom: string;
66
+ /** Accessible name of the % readout (interpolates the live zoom level). */
67
+ zoomReadout: (percent: number) => string;
68
+ undo: string;
69
+ /** Tooltip incl. the keyboard shortcut. */
70
+ undoHint: string;
71
+ redo: string;
72
+ redoHint: string;
73
+ miniMap: string;
74
+ showMinimap: string;
75
+ /** Tooltip on the collapsed minimap toggle. */
76
+ showMinimapHint: string;
77
+ hideMinimap: string;
78
+ selectionActions: string;
79
+ elementPalette: string;
80
+ paletteModelView: string;
81
+ paletteSelectElementsView: string;
82
+ paletteHighlightHint: string;
83
+ edge: string;
84
+ label: string;
85
+ type: string;
86
+ connection: string;
87
+ stereotype: string;
88
+ object: string;
89
+ source: string;
90
+ target: string;
91
+ style: string;
92
+ selectPlaceholder: string;
93
+ addComment: string;
94
+ points: string;
95
+ negativePointsAllowed: string;
96
+ feedback: string;
97
+ deleteAssessment: string;
98
+ deleteAssessmentFor: (name: string) => string;
99
+ assessmentFor: (type: string) => string;
100
+ nextAssessment: string;
101
+ noComment: string;
102
+ notGraded: string;
103
+ node: string;
104
+ attribute: string;
105
+ method: string;
106
+ /** Visible title for a concrete node type identifier. */
107
+ nodeTypeLabel: (nodeType?: string) => string;
108
+ startEvent: string;
109
+ intermediateEvent: string;
110
+ gateway: string;
111
+ gatewayType: string;
112
+ startType: string;
113
+ endType: string;
114
+ intermediateType: string;
115
+ taskType: string;
116
+ marker: string;
117
+ pool: string;
118
+ task: string;
119
+ endEvent: string;
120
+ bpmnDefault: string;
121
+ bpmnTimer: string;
122
+ bpmnConditional: string;
123
+ bpmnSignal: string;
124
+ bpmnEscalation: string;
125
+ bpmnError: string;
126
+ bpmnCompensation: string;
127
+ bpmnTerminate: string;
128
+ bpmnMessageCatch: string;
129
+ bpmnMessageThrow: string;
130
+ bpmnTimerCatch: string;
131
+ bpmnEscalationThrow: string;
132
+ bpmnConditionalCatch: string;
133
+ bpmnLinkCatch: string;
134
+ bpmnLinkThrow: string;
135
+ bpmnCompensationThrow: string;
136
+ bpmnSignalCatch: string;
137
+ bpmnSignalThrow: string;
138
+ bpmnExclusive: string;
139
+ bpmnParallel: string;
140
+ bpmnInclusive: string;
141
+ bpmnEventBased: string;
142
+ bpmnComplex: string;
143
+ bpmnUser: string;
144
+ bpmnSend: string;
145
+ bpmnReceive: string;
146
+ bpmnManual: string;
147
+ bpmnBusinessRule: string;
148
+ bpmnScript: string;
149
+ bpmnMarkerNone: string;
150
+ bpmnParallelMultiInstance: string;
151
+ bpmnSequentialMultiInstance: string;
152
+ bpmnLoop: string;
153
+ marking: string;
154
+ tokens: string;
155
+ capacity: string;
156
+ weight: string;
157
+ setFiniteCapacity: string;
158
+ setInfiniteCapacity: string;
159
+ nonterminal: string;
160
+ terminal: string;
161
+ class: string;
162
+ classType: string;
163
+ abstractClass: string;
164
+ interface: string;
165
+ enumeration: string;
166
+ reorderAttribute: string;
167
+ newAttribute: string;
168
+ addAttribute: string;
169
+ deleteAttribute: string;
170
+ attributes: string;
171
+ reorderMethod: string;
172
+ newMethod: string;
173
+ addMethod: string;
174
+ deleteMethod: string;
175
+ methods: string;
176
+ markMethodAsAbstract: string;
177
+ unmarkMethodAsAbstract: string;
178
+ abstractMethod: string;
179
+ messages: string;
180
+ message: string;
181
+ addMessage: string;
182
+ deleteMessage: (label: string) => string;
183
+ switchDirection: (direction: string) => string;
184
+ switchDirectionFor: (label: string, direction: string) => string;
185
+ messagePlaceholder: (index: number) => string;
186
+ messageFallbackLabel: (index: number) => string;
187
+ messageExists: string;
188
+ duplicateMessage: string;
189
+ swimlane: string;
190
+ lanes: string;
191
+ reorderLane: string;
192
+ deleteLane: string;
193
+ addLane: string;
194
+ laneName: string;
195
+ defaultLaneName: (index: number) => string;
196
+ orientation: string;
197
+ orientationVertical: string;
198
+ orientationHorizontal: string;
199
+ resizeLane: string;
200
+ componentName: string;
201
+ subsystemName: string;
202
+ stereotypePlaceholder: string;
203
+ isInitialMarking: string;
204
+ actionTable: string;
205
+ actions: string;
206
+ id: string;
207
+ actionName: string;
208
+ condition: string;
209
+ deleteActionRow: string;
210
+ addActionRow: string;
211
+ showCrossbar: string;
212
+ negatedCondition: string;
213
+ edgeType: string;
214
+ swapSourceTarget: string;
215
+ multiplicityLabel: (name: string) => string;
216
+ roleLabel: (name: string) => string;
217
+ deleteEdge: string;
218
+ editEdge: string;
219
+ deploymentAssociation: string;
220
+ deploymentDependency: string;
221
+ providedInterface: string;
222
+ requiredInterface: string;
223
+ sequenceFlow: string;
224
+ messageFlow: string;
225
+ associationFlow: string;
226
+ dataAssociationFlow: string;
227
+ association: string;
228
+ include: string;
229
+ extend: string;
230
+ generalization: string;
231
+ biAssociation: string;
232
+ uniAssociation: string;
233
+ aggregation: string;
234
+ composition: string;
235
+ inheritance: string;
236
+ dependency: string;
237
+ realization: string;
238
+ lineColor: string;
239
+ textColor: string;
240
+ fillColor: string;
241
+ namePlaceholder: string;
242
+ editColors: string;
243
+ editColorsFor: (label: string) => string;
244
+ colorPicker: (label: string) => string;
245
+ pickColor: string;
246
+ customColor: string;
247
+ custom: string;
248
+ reset: string;
249
+ /** Interpolated a11y label + tooltip for the header stereotype toggle. */
250
+ stereotypeToggleLabel: (name: string) => string;
251
+ stereotypeToggleTooltip: (shown: boolean, name: string) => string;
252
+ attributeWord: string;
253
+ methodWord: string;
254
+ classWord: string;
255
+ objectWord: string;
256
+ communicationObjectWord: string;
257
+ componentWord: string;
258
+ subsystemWord: string;
259
+ nodeWord: string;
260
+ }
261
+
52
262
  declare enum ApollonMode {
53
263
  Modelling = "Modelling",
54
264
  Exporting = "Exporting",
@@ -164,18 +374,38 @@ declare function Class({ id, width, height, data, }: NodeProps<Node_2<ClassNodeP
164
374
 
165
375
  declare type ClassNodeElement = {
166
376
  id: string;
377
+ /**
378
+ * Abstract modifier — renders the member's signature in italics (UML 2.5.1
379
+ * §9.4). Only ever set on *methods*: attributes are `StructuralFeature`s and
380
+ * cannot be abstract, so the attribute editor never surfaces the control.
381
+ */
382
+ isAbstract?: boolean;
167
383
  } & DefaultNodeProps;
168
384
 
169
385
  declare type ClassNodeProps = {
170
386
  methods: ClassNodeElement[];
171
387
  attributes: ClassNodeElement[];
172
- stereotype?: ClassType;
388
+ /** Metaclass keyword only (`«interface»` / `«enumeration»`). */
389
+ stereotype?: ClassStereotype;
390
+ /**
391
+ * Class-level abstract modifier — renders the class name in italics (UML
392
+ * 2.5.1 §9.2.4). Orthogonal to `stereotype`; there is no `«abstract»` keyword.
393
+ */
394
+ isAbstract?: boolean;
173
395
  } & DefaultNodeProps;
174
396
 
175
- declare enum ClassType {
176
- Abstract = "Abstract",
177
- Interface = "Interface",
178
- Enumeration = "Enumeration"
397
+ /**
398
+ * UML class-diagram metaclass keywords, rendered in guillemets above the class
399
+ * name (e.g. `«interface»`). These are keywords denoting a distinct metaclass —
400
+ * NOT modifiers. Abstractness is a separate boolean (`isAbstract`), shown by an
401
+ * italic name, per UML 2.5.1 §9.2.4; there is no `«abstract»` keyword.
402
+ *
403
+ * Values are the serialized, already-lowercase spelling from the UML keyword
404
+ * table (UML 2.5.1 Annex C, Table C.1), so the stored value equals what renders.
405
+ */
406
+ declare enum ClassStereotype {
407
+ Interface = "interface",
408
+ Enumeration = "enumeration"
179
409
  }
180
410
 
181
411
  declare type CollaborationCursor = {
@@ -286,6 +516,8 @@ declare type CustomEdgeProps = {
286
516
  targetRole: string | null;
287
517
  targetMultiplicity: string | null;
288
518
  points: IPoint[];
519
+ sourceAnchor?: FreeformEdgeAnchor;
520
+ targetAnchor?: FreeformEdgeAnchor;
289
521
  label?: string | null;
290
522
  messages?: MessageData[];
291
523
  strokeColor?: string;
@@ -514,6 +746,16 @@ declare function FlowchartProcess({ id, width, height, data, parentId, }: NodePr
514
746
 
515
747
  declare function FlowchartTerminal({ id, width, height, data, parentId, }: NodeProps<Node_2<DefaultNodeProps>>): JSX.Element | null;
516
748
 
749
+ declare type FreeformEdgeAnchor = {
750
+ side: Position;
751
+ /**
752
+ * Offset along the side, normalized to the current node side length. The
753
+ * editor rounds the resolved point to whole flow pixels, so a drop can land
754
+ * on any pixel while still scaling sensibly if the node is resized later.
755
+ */
756
+ ratio: number;
757
+ };
758
+
517
759
  declare type InteractiveElements = {
518
760
  elements: {
519
761
  [id: string]: boolean;
@@ -565,6 +807,8 @@ declare type MetadataStore = {
565
807
  readonly: boolean;
566
808
  debug: boolean;
567
809
  scrollLock: boolean;
810
+ /** User-facing strings for the editor's own chrome; host-overridable for i18n. */
811
+ labels: ApollonLabels;
568
812
  scrollEnabled: boolean;
569
813
  connectionGuidanceActive: boolean;
570
814
  connectionGuidanceSourceNodeId: string | null;
@@ -577,6 +821,7 @@ declare type MetadataStore = {
577
821
  setAvailableViews: (availableViews: ApollonView[]) => void;
578
822
  setReadonly: (readonly: boolean) => void;
579
823
  setScrollLock: (scrollLock: boolean) => void;
824
+ setLabels: (labels: ApollonLabels) => void;
580
825
  setScrollEnabled: (scrollEnabled: boolean) => void;
581
826
  startConnectionGuidance: (sourceNodeId: string | null, sourceHandleId: string | null) => void;
582
827
  stopConnectionGuidance: () => void;
package/dist/internals.js CHANGED
@@ -1,11 +1,11 @@
1
- import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, t as l, u } from "./versionConverter-C-s36Ory.js";
1
+ import { _ as e, d as t, f as n, g as r, l as i, m as a, n as o, p as s, t as c, u as l, v as u } from "./yjsSync-BeQGvR_C.js";
2
2
  import * as d from "yjs";
3
3
  //#region lib/sync/headless.ts
4
4
  function f(e = new d.Doc()) {
5
5
  let t = () => {};
6
6
  return {
7
7
  ydoc: e,
8
- sync: new r(e, {
8
+ sync: new o(e, {
9
9
  getState: () => ({
10
10
  updateNodesFromYjs: t,
11
11
  updateEdgesFromYjs: t,
@@ -26,4 +26,4 @@ function f(e = new d.Doc()) {
26
26
  };
27
27
  }
28
28
  //#endregion
29
- export { n as MessageType, r as YjsSync, l as convertV2ToV4, o as convertV3EdgeTypeToV4, c as convertV3HandleToV4, i as convertV3MessagesToV4, e as convertV3NodeTypeToV4, s as convertV3ToV4, f as createHeadlessSync, t as isV2Format, a as isV3Format, u as isV4Format };
29
+ export { c as MessageType, o as YjsSync, i as convertV2ToV4, l as convertV3EdgeTypeToV4, t as convertV3HandleToV4, n as convertV3MessagesToV4, s as convertV3NodeTypeToV4, a as convertV3ToV4, f as createHeadlessSync, r as isV2Format, e as isV3Format, u as isV4Format };