Files
mermaid/cypress/platform/min-size-tester.html
2024-10-01 23:45:32 +02:00

172 lines
5.2 KiB
HTML

<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<link
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
rel="stylesheet"
/>
<style>
body {
font-family: 'Arial';
background-color: #333;
}
h3 {
color: white;
}
</style>
</head>
<body>
<div class="flex w-full">
<div id="diagram-fixed"></div>
<div id="diagram-normal"></div>
</div>
<script type="module">
import mermaid from './mermaid.esm.mjs';
import layouts from './mermaid-layout-elk.esm.mjs';
mermaid.registerLayoutLoaders(layouts);
mermaid.parseError = function (err, hash) {
console.error('Mermaid error: ', err);
};
mermaid.initialize({
startOnLoad: false,
//look: 'handdrawn',
// layout: 'fixed',
theme: 'neo-dark',
//layout: 'elk',
fontFamily: 'Kalam',
logLevel: 1,
});
// let shape = 'rect'; // Done
//let shape = 'rounded'; // Done
//let shape = 'stadium'; // Done
// let shape = 'fr-rect'; // Done
// let shape = 'cyl'; // Done
//let shape = 'circle'; // Done
// let shape = 'odd'; // Done
// let shape = 'diam'; //Done
// let shape = 'hex'; // Done
// let shape = 'lean-r'; // Done
// let shape = 'lean-l'; // Done
// let shape = 'trap-b'; // Done
// let shape = 'trap-t'; // Done
// let shape = 'dbl-circ'; // Done
// let shape = 'text'; // Done
// let shape = 'notch-rect'; // Done
// let shape = 'lin-rect'; // Done
//let shape = 'sm-circ'; // Done
// let shape = 'fr-circ'; //Done
//let shape = 'fork'; // Done
//let shape = 'hourglass'; //Done
// let shape = 'bolt'; //Done
// let shape = 'doc'; // Done
// let shape = 'delay'; // Done
// let shape = 'h-cyl'; // Done
// let shape = 'lin-cyl'; // Done
// let shape = 'curv-trap'; // Done
// let shape = 'div-rect'; // Done
//let shape = 'tri'; // Done
// let shape = 'win-pane'; //Done
// let shape = 'f-circ'; // Done
// let shape = 'lin-doc'; // Done
// let shape = 'notch-pent'; // Done
// let shape = 'flip-tri'; // Done
// let shape = 'sl-rect'; // Done
// let shape = 'cross-circ'; // Done
// let shape = 'bow-rect'; // Done
// let shape = 'st-rect'; // Done
// let shape = 'flag';
// let shape = 'docs';
// let shape = 'brace';
// let shape = 'brace-r';
// let shape = 'braces';
// let shape = 'tag-doc';
let configFixed = `---
config:
layout: fixed
---
`;
let code = `flowchart TB
%% n80["APA ksldj hfaskljdh aklsjdhf klasjdhf klasjhf klsajdh klasjdhf klasjdhf klasjdh klasjhf klasjdh klajsdhfklasjdhf kljadh fklasjdhf klajsdhf lkasdhf klajsdhf klasjdhfklasjdh klasjhf klasdfh klasdfh aklsjfh akjshkasldfh klasdfh klasjh fklsjhf klasdhf kljasdhf klasdhf klj"]
%% n80@{ shape: '${shape}'}
n81@{ label: "Ashish", shape: '${shape}'}
%%n82@{ label: "n82", shape: '${shape}'}
%%n83@{ label: "n83", shape: '${shape}'}
`;
let positions = {
edges: {},
nodes: {
n81: {
x: 0,
y: 10,
width: 107.7,
height: 65,
},
n80: {
x: -400,
y: 10,
width: 1,
height: 1,
},
n82: {
x: 0,
y: 110,
},
n83: {
x: 80,
y: 10,
},
n84: {
x: 1200,
y: 10,
width: 300,
height: 200,
},
},
};
console.log(configFixed + code);
const { svg } = await mermaid.render(
'the-id-of-the-svg-1',
configFixed + code,
undefined,
positions
);
const elem = document.querySelector('#diagram-fixed');
elem.innerHTML = svg;
const { svg: svg2 } = await mermaid.render('the-id-of-the-svg-2', code, undefined, positions);
const elem2 = document.querySelector('#diagram-normal');
elem2.innerHTML = svg2;
</script>
</body>
</html>