8000 [WebProfilerBundle] Inline flowchart-only Mermaid version · symfony/symfony@8db647e · GitHub
[go: up one dir, main page]

Skip to content

Commit 8db647e

Browse files
committed
[WebProfilerBundle] Inline flowchart-only Mermaid version
1 parent e70dcb1 commit 8db647e

File tree

4 files changed

+512
-2
lines changed

4 files changed

+512
-2
lines changed

src/Symfony/Bundle/WebProfilerBundle/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/phpunit.xml.dist export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5+
/Resources/views/Script/Mermaid/Makefile export-ignore

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/workflow.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
<p>There are no workflows configured.</p>
133133
</div>
134134
{% else %}
135-
<script type="module">
136-
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
135+
<script>
136+
{{ source('@WebProfiler/Script/Mermaid/mermaid-flowchart-v2.min.js') }}
137137
const isDarkMode = document.querySelector('body').classList.contains('theme-dark');
138138
mermaid.initialize({
139139
flowchart: { useMaxWidth: false },
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
define diagram-orchestration
2+
import { diagram as flowchartV2 } from '../diagrams/flowchart/flowDiagram-v2.js';
3+
import { registerDiagram } from './diagramAPI.js';
4+
5+
let hasLoadedDiagrams = false;
6+
export const addDiagrams = () => {
7+
if (hasLoadedDiagrams) {
8+
return;
9+
}
10+
hasLoadedDiagrams = true;
11+
registerDiagram('flowchart-v2', flowchartV2, () => true);
12+
};
13+
endef
14+
15+
.PHONY: mermaid-flowchart-v2.min.js
16+
mermaid-flowchart-v2.min.js: | mermaid-$(if $(tag),$(tag),$(error missing “tag” variable))/node_modules
17+
$(file >mermaid-$(tag)/packages/mermaid/src/diagram-api/diagram-orchestration.ts,$(diagram-orchestration))
18+
pnpm -C mermaid-$(tag) run build
19+
cp mermaid-$(tag)/packages/mermaid/dist/mermaid.min.js $@
20+
21+
mermaid-%/node_modules: | mermaid-%
22+
pnpm -C $(@D) install --ignore-scripts
23+
24+
mermaid-%:
25+
curl -fL https://github.com/mermaid-js/mermaid/archive/refs/tags/$*.tar.gz | tar -xz --strip-components=1 --one-top-level=$@
26+

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Script/Mermaid/mermaid-flowchart-v2.min.js

Lines changed: 483 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0