Skip to content

Commit

Permalink
Merge pull request mermaid-js#1417 from mermaid-js/release-promotion
Browse files Browse the repository at this point in the history
Release live editor
  • Loading branch information
sidharthv96 committed Apr 2, 2024
2 parents 6de7cbc + e635b23 commit 8fd1c15
Show file tree
Hide file tree
Showing 5 changed files with 1,363 additions and 694 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/diagramUpdate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ A & B & C & D & E --> F & G & K & Z & i`);
});

it('supports commenting code out/in', () => {
cy.get('#editor').contains('Car').click();
cy.get('#editor').contains('Car').click({ force: true });
cy.get('#editor').get('textarea').type(`${cmd}/`, { force: true });
cy.get('#view').contains('Car').should('not.exist');

Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
"devDependencies": {
"@cypress/snapshot": "2.1.7",
"@sveltejs/adapter-static": "3.0.1",
"@sveltejs/kit": "2.5.2",
"@sveltejs/kit": "2.5.5",
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"@testing-library/svelte": "4.1.0",
"@types/lodash-es": "^4.17.12",
"@types/pako": "2.0.3",
"@types/uuid": "9.0.8",
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@vitest/ui": "^1.1.3",
"autoprefixer": "^10.4.14",
"c8": "7.14.0",
"chai": "^4.3.7",
"cssnano": "^6.0.0",
"cypress": "12.17.4",
"cypress-localstorage-commands": "2.2.5",
"eslint": "8.56.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "2.15.1",
"eslint-plugin-es": "^4.1.0",
Expand Down Expand Up @@ -69,12 +69,13 @@
"vitest-dom": "^0.1.1"
},
"dependencies": {
"@mermaid-js/mermaid-zenuml": "^0.2.0",
"daisyui": "2.52.0",
"dayjs": "^1.11.7",
"js-base64": "3.7.7",
"lodash-es": "^4.17.21",
"mermaid": "10.9.0",
"monaco-editor": "0.45.0",
"monaco-editor": "0.47.0",
"pako": "2.1.0",
"plausible-tracker": "^0.3.8",
"random-word-slugs": "0.1.7",
Expand All @@ -89,7 +90,7 @@
},
"volta": {
"node": "18.19.1",
"yarn": "1.22.21"
"yarn": "1.22.22"
},
"engines": {
"node": ">=16.7"
Expand Down
29 changes: 27 additions & 2 deletions src/lib/components/Preset.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@
C --> db
D --> C
style m fill:#d6d,stroke:#333,stroke-width:4px
`,
ZenUML: `zenuml
title Order Service
@Actor Client #FFEBE6
@Boundary OrderController #0747A6
@EC2 <<BFF>> OrderService #E3FCEF
group BusinessService {
@Lambda PurchaseService
@AzureFunction InvoiceService
}
@Starter(Client)
// \`POST /orders\`
OrderController.post(payload) {
OrderService.create(payload) {
order = new Order(payload)
if(order != null) {
par {
PurchaseService.createPO(order)
InvoiceService.createInvoice(order)
}
}
}
}
`
};
Expand All @@ -154,7 +178,7 @@
};
// Adding in this array will add an icon to the preset menu
const newDiagrams: SampleTypes[] = ['QuadrantChart', 'XYChart', 'Block'];
const newDiagrams: SampleTypes[] = ['QuadrantChart', 'XYChart', 'Block', 'ZenUML'];
const diagramOrder: SampleTypes[] = [
'Flow',
'Sequence',
Expand All @@ -168,7 +192,8 @@
'Mindmap',
'QuadrantChart',
'XYChart',
'Block'
'Block',
'ZenUML'
];
</script>

Expand Down
5 changes: 5 additions & 0 deletions src/lib/util/mermaid.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import mermaid from 'mermaid';
import type { MermaidConfig, RenderResult } from 'mermaid';
import zenuml from '@mermaid-js/mermaid-zenuml';

const init = mermaid.registerExternalDiagrams([zenuml]);

export const render = async (
config: MermaidConfig,
code: string,
id: string
): Promise<RenderResult> => {
await init;

// Should be able to call this multiple times without any issues.
mermaid.initialize(config);
return await mermaid.render(id, code);
Expand Down
Loading

0 comments on commit 8fd1c15

Please sign in to comment.