add latest

This commit is contained in:
2022-09-21 23:43:12 +01:00
parent 530db529ce
commit 423664fc47
17 changed files with 131 additions and 31 deletions

View File

@@ -0,0 +1,25 @@
# boilerplate production chains
## diagram definition
```
`flowchart LR; `
```
## plain chain
```
NAME(<img src='${charcoalKilnIcon}' class='icon-size' /><span class='ratio-count'>1</span>)
```
## chain with lower efficiency
```
NAME(<span class='icon-flex-row'><img src='${steelIcon}' class='icon-size' /><span class='icon-flex-col q-pl-sm'><span class='efficiency-perc'>66%</span><span class='ratio-count'>1</span></span></span>)
```
## chain with electricity
```
NAME(<span class='icon-flex-row'><img src='${highWheelerIcon}' class='icon-size' /><span class='icon-flex-col q-pl-sm'><span><img src='${lightningIcon}' class='electricity-icon' /></span><span class='ratio-count'>1</span></span></span>)
```

37
docs/todo.todo Normal file
View File

@@ -0,0 +1,37 @@
mermaid graphs using endent?
push to gh pages
document div with background instead of img
document vite importing assets
importing an image
dynamic imports?
loop over to import the images from json file?
fix link to homepage (loading into new tab)
doc this
div with background css
watchEffect(() => {
if (mermaidGraph.value != null) {
mermaid.render(
'test',
"flowchart LR; Wood((<div class='wood-icon'><span>1</span></div>))-->Icon((<div class='timber-icon'>1</div>)); classDef mermaid-height height:50px; class Wood mermaid-height",
(svgCode: string) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
mermaidGraph.value!.innerHTML = svgCode;
}
);
} else {
console.log('null value');
}
});
.timber-icon {
background: no-repeat center/100% url('../assets/annoIcons/Timber.webp');
width: 40px;
height: 40px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -1,16 +1,31 @@
<template> <template>
<div ref="mermaidGraph"></div> <div>
<br /> <div ref="timber"></div>
<div ref="imageGraph"></div> <div ref="steelBeams"></div>
<div ref="highWheeler"></div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import mermaid from 'mermaid'; import mermaid from 'mermaid';
import { onMounted, ref, watchEffect } from 'vue'; import { onMounted, ref, watchEffect } from 'vue';
// Icons
import woodIcon from '../assets/annoIcons/Wood.webp';
import timberIcon from '../assets/annoIcons/Timber.webp';
import charcoalKilnIcon from '../assets/annoIcons/Charcoal_kiln.webp';
import coalIcon from '../assets/annoIcons/Coal.webp';
import caoutchoucIcon from '../assets/annoIcons/Caoutchouc.webp';
import highWheelerIcon from '../assets/annoIcons/High_wheeler.webp';
import ironIcon from '../assets/annoIcons/Iron.webp';
import steelIcon from '../assets/annoIcons/Steel.webp';
import steelBeamsIcon from '../assets/annoIcons/Steel_beams.webp';
import lightningIcon from '../assets/annoIcons/Lightning.png';
// variables // variables
const mermaidGraph = ref<HTMLInputElement | null>(null); const timber = ref<HTMLInputElement | null>(null);
const imageGraph = ref<HTMLInputElement | null>(null); const steelBeams = ref<HTMLInputElement | null>(null);
const highWheeler = ref<HTMLInputElement | null>(null);
// load mermaid graph // load mermaid graph
onMounted(() => { onMounted(() => {
@@ -18,37 +33,47 @@ onMounted(() => {
startOnLoad: false, startOnLoad: false,
logLevel: 'fatal', logLevel: 'fatal',
securityLevel: 'loose', securityLevel: 'loose',
theme: 'neutral' theme: 'neutral',
flowchart: { htmlLabels: true }
}); });
}); });
watchEffect(() => { watchEffect(() => {
if (mermaidGraph.value != null) { if (timber.value != null) {
mermaid.render( mermaid.render(
'test', 'timber',
"graph LR; Wood(<div class='wood-icon'><span>1</span></div>)-->Icon(<div class='timber-icon'>1</div>)", `flowchart LR; Wood(<img src='${woodIcon}' class='icon-size' /><span class='ratio-count'>1</span>)-->Timber(<img src='${timberIcon}' class='icon-size' /><span class='ratio-count'>1</span>)`,
(svgCode: string) => { (svgCode: string) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
mermaidGraph.value!.innerHTML = svgCode; timber.value!.innerHTML = svgCode;
} }
); );
} else {
console.log('null value');
} }
}); });
watchEffect(() => { watchEffect(() => {
if (imageGraph.value != null) { if (steelBeams.value != null) {
mermaid.render( mermaid.render(
'woodTimber', 'steelBeams',
"graph LR; Wood(<img src='/annoIcons/buildingMaterials/Wood.webp' class='icon-size' />)-->Icon(<img src='/annoIcons/buildingMaterials/Timber.webp' class='icon-size' />)", `flowchart LR; CharcoalKiln(<img src='${charcoalKilnIcon}' class='icon-size' /><span class='ratio-count'>1</span>) & Iron(<img src='${ironIcon}' class='icon-size' /><span class='ratio-count'>1</span>) --> Steel(<span class='icon-flex-row'><img src='${steelIcon}' class='icon-size' /><span class='icon-flex-col q-pl-sm'><span class='efficiency-perc'>66%</span><span class='ratio-count'>1</span></span></span>) --> SteelBeams(<img src='${steelBeamsIcon}' class='icon-size' /><span class='ratio-count'>1</span>)`,
(svgCode: string) => { (svgCode: string) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
imageGraph.value!.innerHTML = svgCode; steelBeams.value!.innerHTML = svgCode;
}
);
}
});
watchEffect(() => {
if (highWheeler.value != null) {
mermaid.render(
'highWheeler',
`flowchart LR; Iron(<img src='${ironIcon}' class='icon-size' /><span class='ratio-count'>1</span>) & Coal(<img src='${coalIcon}' class='icon-size' /><span class='ratio-count'>1</span>) --> Steel(<img src='${steelIcon}' class='icon-size' /><span class='ratio-count'>2</span>) --> HighWheeler(<span class='icon-flex-row'><img src='${highWheelerIcon}' class='icon-size' /><span class='icon-flex-col q-pl-sm'><span><img src='${lightningIcon}' class='electricity-icon' /></span><span class='ratio-count'>1</span></span></span>); Caoutchouc(<img src='${caoutchoucIcon}' class='icon-size' /><span class='ratio-count'>4</span>) --> HighWheeler`,
(svgCode: string) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
highWheeler.value!.innerHTML = svgCode;
} }
); );
} else {
console.log('null value');
} }
}); });
</script> </script>
@@ -59,19 +84,32 @@ watchEffect(() => {
height: 40px; height: 40px;
} }
.wood-icon { .ratio-count {
background: no-repeat center/100% font-weight: bold;
url('../assets/annoIcons/buildingMaterials/Wood.webp'); text-align: center;
width: 40px;
height: 40px;
display: flex;
align-items: flex-end;
justify-content: center;
} }
.timber-icon {
background: no-repeat center/100% .efficiency-perc {
url('../assets/annoIcons/buildingMaterials/Timber.webp'); font-weight: bold;
width: 40px; color: $green-9 !important;
height: 40px; }
.electricity-container {
margin-bottom: -5px;
}
.electricity-icon {
width: 22px;
margin-bottom: -5px;
}
.icon-flex-row {
display: flex;
flex-direction: row;
}
.icon-flex-col {
display: flex;
flex-direction: column;
} }
</style> </style>