Skip to content

Commit

Permalink
Merge pull request #230 from mermaid-js/feat/ref-at-root-level
Browse files Browse the repository at this point in the history
Feat/ref at root level; anonymous section
  • Loading branch information
MrCoder authored Dec 16, 2024
2 parents 91205f4 + a089ac5 commit 286f771
Show file tree
Hide file tree
Showing 6 changed files with 359 additions and 380 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
timer = setTimeout(() => {
const theme =
localStorage.getItem(`${location.hostname}-zenuml-theme`) ||
"theme-idle-afternoon";
"theme-default";
window.zenUml
.render(cm.getValue(), {
theme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ export default {
const atom = computed(() => section.value?.atom()?.getFormattedText());
const blockInSection = computed(() => braceBlock.value?.block());
const label = computed(
() => atom.value ?? capitalize(section.value.SECTION()),
);
const label = computed(() => atom.value ?? capitalize("section"));
return {
label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ describe("MessageLayer", () => {
expect(messageLayerWrapper.find(".pt-24").exists()).toBeTruthy();
});
it("gets participant names", async () => {
expect(messageLayerWrapper.vm.origin).toBeNull();
expect(messageLayerWrapper.vm.origin).toBe("_STARTER_");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ TODO: we may need to consider the width of self message on right most participan
<template>
<div class="message-layer relative z-30 pt-24 pb-10">
<block
v-if="!!origin"
:context="context"
:style="{ 'padding-left': paddingLeft + 'px' }"
:origin="origin"
Expand Down Expand Up @@ -35,7 +34,7 @@ const paddingLeft = computed(() => {

const origin = computed(() => {
const ownableMessages = AllMessages(rootContext.value);
if (ownableMessages.length === 0) return null;
if (ownableMessages.length === 0) return _STARTER_;
return ownableMessages[0].from || _STARTER_;
});

Expand Down
4 changes: 3 additions & 1 deletion src/g4/sequenceParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ critical
| CRITICAL
;

// section(name) {}
section
: SECTION (OPAR atom? CPAR)? braceBlock
| SECTION
| braceBlock // allows anonymous section. This is mostly for error tolerance (e.g. ref(x) { m1 }).
| SECTION // Error tolerance for incomplete section
;

creation
Expand Down
Loading

0 comments on commit 286f771

Please sign in to comment.