@zenuml/core 4.1.0 → 4.2.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.
@@ -2738,7 +2738,7 @@ class sequenceParser extends antlr4.Parser {
2738
2738
 
2739
2739
 
2740
2740
  returnAsyncMessage() {
2741
- let localctx = new ReturnAsyncMessageContext$2(this, this._ctx, this.state);
2741
+ let localctx = new ReturnAsyncMessageContext$3(this, this._ctx, this.state);
2742
2742
  this.enterRule(localctx, 30, sequenceParser.RULE_returnAsyncMessage);
2743
2743
  var _la = 0; // Token type
2744
2744
  try {
@@ -5800,7 +5800,7 @@ let RetContext$3 = class RetContext extends antlr4.ParserRuleContext {
5800
5800
  };
5801
5801
 
5802
5802
  returnAsyncMessage() {
5803
- return this.getTypedRuleContext(ReturnAsyncMessageContext$2,0);
5803
+ return this.getTypedRuleContext(ReturnAsyncMessageContext$3,0);
5804
5804
  };
5805
5805
 
5806
5806
  enterRule(listener) {
@@ -5820,7 +5820,7 @@ let RetContext$3 = class RetContext extends antlr4.ParserRuleContext {
5820
5820
 
5821
5821
 
5822
5822
 
5823
- let ReturnAsyncMessageContext$2 = class ReturnAsyncMessageContext extends antlr4.ParserRuleContext {
5823
+ let ReturnAsyncMessageContext$3 = class ReturnAsyncMessageContext extends antlr4.ParserRuleContext {
5824
5824
 
5825
5825
  constructor(parser, parent, invokingState) {
5826
5826
  if(parent===undefined) {
@@ -8714,7 +8714,7 @@ sequenceParser.WidthContext = WidthContext;
8714
8714
  sequenceParser.EmojiContext = EmojiContext;
8715
8715
  sequenceParser.BlockContext = BlockContext;
8716
8716
  sequenceParser.RetContext = RetContext$3;
8717
- sequenceParser.ReturnAsyncMessageContext = ReturnAsyncMessageContext$2;
8717
+ sequenceParser.ReturnAsyncMessageContext = ReturnAsyncMessageContext$3;
8718
8718
  sequenceParser.DividerContext = DividerContext$1;
8719
8719
  sequenceParser.DividerNoteContext = DividerNoteContext;
8720
8720
  sequenceParser.StatContext = StatContext$3;
@@ -8779,6 +8779,10 @@ const blankParticipant = {
8779
8779
  };
8780
8780
  let Participant$1 = class Participant {
8781
8781
  name;
8782
+ // Fields the renderer-facing ParticipantView (ir/contract.ts) exposes are
8783
+ // public; they were already fully exposed via ToValue(), so the previous
8784
+ // `private` was inconsistent encapsulation. `width` stays private — it is not
8785
+ // part of ParticipantView.
8782
8786
  stereotype;
8783
8787
  width;
8784
8788
  groupId;
@@ -9204,7 +9208,7 @@ const seqParser$7 = sequenceParser;
9204
9208
  const CreationContext$6 = seqParser$7.CreationContext;
9205
9209
  const MessageContext$6 = seqParser$7.MessageContext;
9206
9210
  const AsyncMessageContext$2 = seqParser$7.AsyncMessageContext;
9207
- const ReturnAsyncMessageContext$1 = seqParser$7.ReturnAsyncMessageContext;
9211
+ const ReturnAsyncMessageContext$2 = seqParser$7.ReturnAsyncMessageContext;
9208
9212
  const RetMessageContext = seqParser$7.RetContext;
9209
9213
 
9210
9214
  CreationContext$6.prototype.Assignee = function () {
@@ -9264,12 +9268,12 @@ AsyncMessageContext$2.prototype.Owner = function () {
9264
9268
  return this.To() || getOwnerFromAncestor(this.parentCtx);
9265
9269
  };
9266
9270
 
9267
- ReturnAsyncMessageContext$1.prototype.To = function () {
9271
+ ReturnAsyncMessageContext$2.prototype.To = function () {
9268
9272
  const toCtx = this.to();
9269
9273
  return toCtx?.name?.()?.getFormattedText() || toCtx?.getFormattedText();
9270
9274
  };
9271
9275
 
9272
- ReturnAsyncMessageContext$1.prototype.Owner = function () {
9276
+ ReturnAsyncMessageContext$2.prototype.Owner = function () {
9273
9277
  return this.To() || getOwnerFromAncestor(this.parentCtx);
9274
9278
  };
9275
9279
 
@@ -9386,13 +9390,13 @@ RefContext.prototype.Participants = function() {
9386
9390
  return this.name().slice(1) ?? [];
9387
9391
  };
9388
9392
 
9389
- const ParserRuleContext = antlr4.ParserRuleContext;
9393
+ const ParserRuleContext$1 = antlr4.ParserRuleContext;
9390
9394
  const StatContext$2 = sequenceParser.StatContext;
9391
9395
  const ProgContext = sequenceParser.ProgContext;
9392
9396
  const MessageContext$4 = sequenceParser.MessageContext;
9393
9397
  const CreationContext$4 = sequenceParser.CreationContext;
9394
9398
 
9395
- ParserRuleContext.prototype.Origin = function () {
9399
+ ParserRuleContext$1.prototype.Origin = function () {
9396
9400
  let ctx = this.parentCtx;
9397
9401
  while (ctx && !(ctx instanceof StatContext$2 || ctx instanceof ProgContext)) {
9398
9402
  ctx = this.parentCtx;
@@ -9438,8 +9442,8 @@ function formatParameter(param) {
9438
9442
  if (param.namedParameter?.()) {
9439
9443
  const namedParam = param.namedParameter();
9440
9444
  if (namedParam) {
9441
- const expr = namedParam.expr();
9442
- const value = expr ? expr.getFormattedText() : "";
9445
+ const expr2 = namedParam.expr();
9446
+ const value = expr2 ? expr2.getFormattedText() : "";
9443
9447
  return `${namedParam.ID().getText()}=${value}`;
9444
9448
  }
9445
9449
  }
@@ -9449,8 +9453,9 @@ function formatParameter(param) {
9449
9453
  return `${decl.type().getText()} ${decl.ID().getText()}`;
9450
9454
  }
9451
9455
  }
9452
- if (param.expr?.()) {
9453
- return param.expr().getFormattedText();
9456
+ const expr = param.expr?.();
9457
+ if (expr) {
9458
+ return expr.getFormattedText();
9454
9459
  }
9455
9460
  return param.getFormattedText();
9456
9461
  }
@@ -9462,6 +9467,7 @@ const ParametersContext = sequenceParser.ParametersContext;
9462
9467
  const AsyncMessageContext$1 = sequenceParser.AsyncMessageContext;
9463
9468
  const CreationContext$3 = sequenceParser.CreationContext;
9464
9469
  const RetContext$1 = sequenceParser.RetContext;
9470
+ const ReturnAsyncMessageContext$1 = sequenceParser.ReturnAsyncMessageContext;
9465
9471
  MessageContext$3.prototype.SignatureText = function() {
9466
9472
  return this.messageBody()?.func()?.signature()?.map((s) => s?.getFormattedText()).join(".") ?? "";
9467
9473
  };
@@ -9482,7 +9488,7 @@ CreationContext$3.prototype.isParamValid = function() {
9482
9488
  RetContext$1.prototype.SignatureText = function() {
9483
9489
  return this.asyncMessage()?.content()?.getFormattedText() ?? this.returnAsyncMessage()?.content()?.getFormattedText() ?? this.expr()?.getFormattedText() ?? "";
9484
9490
  };
9485
- sequenceParser.ReturnAsyncMessageContext.prototype.SignatureText = function() {
9491
+ ReturnAsyncMessageContext$1.prototype.SignatureText = function() {
9486
9492
  return this.content()?.getFormattedText() ?? "";
9487
9493
  };
9488
9494
  ParametersContext.prototype.getFormattedText = function() {
@@ -9557,46 +9563,47 @@ LoopContext.prototype.Statements = function() {
9557
9563
  };
9558
9564
 
9559
9565
  const seqParser$1 = sequenceParser;
9560
- const CreationContext = seqParser$1.CreationContext;
9561
9566
  const StatContext$1 = seqParser$1.StatContext;
9567
+ const CreationContext = seqParser$1.CreationContext;
9562
9568
  const MessageContext = seqParser$1.MessageContext;
9563
9569
  const AsyncMessageContext = seqParser$1.AsyncMessageContext;
9564
9570
  const ReturnAsyncMessageContext = seqParser$1.ReturnAsyncMessageContext;
9565
9571
  const RetContext = seqParser$1.RetContext;
9566
9572
  CreationContext.prototype.From = function() {
9567
9573
  if (this.parentCtx instanceof StatContext$1) {
9568
- return this.ClosestAncestorStat().Origin();
9574
+ return this.ClosestAncestorStat()?.Origin();
9569
9575
  }
9570
9576
  return void 0;
9571
9577
  };
9572
9578
  MessageContext.prototype.ProvidedFrom = function() {
9573
- const fromCtx = this.messageBody()?.fromTo()?.from();
9574
- return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
9579
+ const fromCtx = this.messageBody()?.fromTo?.()?.from?.();
9580
+ return fromCtx?.name?.()?.getFormattedText?.() || fromCtx?.getFormattedText?.();
9575
9581
  };
9576
9582
  MessageContext.prototype.From = function() {
9577
- return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
9583
+ return this.ProvidedFrom() || this.ClosestAncestorStat()?.Origin();
9578
9584
  };
9579
9585
  AsyncMessageContext.prototype.ProvidedFrom = function() {
9580
9586
  const fromCtx = this.from();
9581
- return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
9587
+ return fromCtx?.name?.()?.getFormattedText?.() || fromCtx?.getFormattedText?.();
9582
9588
  };
9583
9589
  AsyncMessageContext.prototype.From = function() {
9584
- return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
9590
+ return this.ProvidedFrom() || this.ClosestAncestorStat()?.Origin();
9585
9591
  };
9586
9592
  ReturnAsyncMessageContext.prototype.ProvidedFrom = function() {
9587
9593
  const fromCtx = this.from();
9588
- return fromCtx?.name?.()?.getFormattedText() || fromCtx?.getFormattedText();
9594
+ return fromCtx?.name?.()?.getFormattedText?.() || fromCtx?.getFormattedText?.();
9589
9595
  };
9590
9596
  ReturnAsyncMessageContext.prototype.From = function() {
9591
- return this.ProvidedFrom() || this.ClosestAncestorStat().Origin();
9597
+ return this.ProvidedFrom() || this.ClosestAncestorStat()?.Origin();
9592
9598
  };
9593
9599
  RetContext.prototype.From = function() {
9594
- return this.asyncMessage()?.From() || this.returnAsyncMessage()?.From() || this.ClosestAncestorStat().Origin();
9600
+ return this.asyncMessage()?.From?.() || this.returnAsyncMessage()?.From?.() || this.ClosestAncestorStat()?.Origin();
9595
9601
  };
9596
9602
 
9597
9603
  const seqParser = sequenceParser;
9598
9604
  const StatContext = seqParser.StatContext;
9599
- antlr4.ParserRuleContext.prototype.ClosestAncestorStat = function() {
9605
+ const ParserRuleContext = antlr4.ParserRuleContext;
9606
+ ParserRuleContext.prototype.ClosestAncestorStat = function() {
9600
9607
  if (this instanceof StatContext) {
9601
9608
  return this;
9602
9609
  }
@@ -9609,7 +9616,7 @@ antlr4.ParserRuleContext.prototype.ClosestAncestorStat = function() {
9609
9616
  }
9610
9617
  return void 0;
9611
9618
  };
9612
- antlr4.ParserRuleContext.prototype.ClosestAncestorBlock = function() {
9619
+ ParserRuleContext.prototype.ClosestAncestorBlock = function() {
9613
9620
  const parentCtx = this.ClosestAncestorStat()?.parentCtx;
9614
9621
  if (parentCtx instanceof seqParser.BlockContext) {
9615
9622
  return parentCtx;
@@ -9920,33 +9927,31 @@ function OrderedParticipants(rootContext) {
9920
9927
  const cached = orderedParticipantsCache.get(rootContext);
9921
9928
  if (cached) return cached;
9922
9929
  const participants = ToCollector.getParticipants(rootContext);
9923
- const participantEntries = Array.from(participants.participants.entries());
9930
+ const participantEntries = participants.Array().map((p) => p.ToValue());
9924
9931
  const allMessages = AllMessages(rootContext);
9925
9932
  const emptyContext = allMessages.length === 0 && participantEntries.length === 0;
9926
9933
  const someMessagesMissFrom = allMessages.some((m) => !m.from);
9927
9934
  const needDefaultStarter = emptyContext || someMessagesMissFrom;
9928
9935
  if (needDefaultStarter) {
9929
- participantEntries.unshift([
9930
- _STARTER_,
9931
- { ...blankParticipant, name: _STARTER_, isStarter: true }
9932
- ]);
9933
- }
9934
- const result = participantEntries.map(
9935
- (entry, index, entries) => {
9936
- const participant = entry[1];
9937
- const previousName = index > 0 ? entries[index - 1][1].name : "";
9938
- return new Participant(
9939
- participant.name,
9940
- previousName,
9941
- participant.label,
9942
- participant.type,
9943
- participant.stereotype,
9944
- participant.color,
9945
- participant.groupId,
9946
- participant.emoji
9947
- );
9948
- }
9949
- );
9936
+ participantEntries.unshift({
9937
+ ...blankParticipant,
9938
+ name: _STARTER_,
9939
+ isStarter: true
9940
+ });
9941
+ }
9942
+ const result = participantEntries.map((participant, index, entries) => {
9943
+ const previousName = index > 0 ? entries[index - 1].name : "";
9944
+ return new Participant(
9945
+ participant.name,
9946
+ previousName,
9947
+ participant.label,
9948
+ participant.type,
9949
+ participant.stereotype,
9950
+ participant.color,
9951
+ participant.groupId,
9952
+ participant.emoji
9953
+ );
9954
+ });
9950
9955
  orderedParticipantsCache.set(rootContext, result);
9951
9956
  return result;
9952
9957
  }
@@ -10045,7 +10050,7 @@ function longestPathTable(graph, gaps) {
10045
10050
  }
10046
10051
  return [tracker.delta, table];
10047
10052
  }
10048
- function freezeCriticalGaps(table, graph, gaps) {
10053
+ function freezeCriticalGaps(table, gaps) {
10049
10054
  let j = table.length - 1;
10050
10055
  while (j > 0) {
10051
10056
  const argument = table[j].argument;
@@ -10082,7 +10087,7 @@ function find_optimal(matrix) {
10082
10087
  return positionsFromTable(table);
10083
10088
  }
10084
10089
  if (table[n - 1].maximum.velocity > 0) {
10085
- freezeCriticalGaps(table, graph, gaps);
10090
+ freezeCriticalGaps(table, gaps);
10086
10091
  } else {
10087
10092
  advanceGaps(gaps, delta);
10088
10093
  }
@@ -11520,7 +11525,7 @@ function snapX(x) {
11520
11525
  return x;
11521
11526
  }
11522
11527
  const COMMENT_FONT_ASCENT = 15;
11523
- function buildFragmentGeometry(info, coord, coordinates, verticalCoordinates, allParticipants, measureText, commentHeight = 0, commentText, commentStyle, commentYBase) {
11528
+ function buildFragmentGeometry(info, coord, coordinates, verticalCoordinates, allParticipants, _measureText, commentHeight = 0, commentText, commentStyle, commentYBase) {
11524
11529
  const statNode = info.statNode;
11525
11530
  if (!statNode) return null;
11526
11531
  const fragmentCtx = findFragmentContext(statNode);