Skip to content

Commit 09a3bc3

Browse files
committed
* fix one block loops not being displayed
* fix incorrect transition in tutorial * fix appearance of diagram area on error * prevent errors while updating diagram's appearance from clearing diagram * make ordinary blocks rounded and special blocks hexagonal
1 parent 6736670 commit 09a3bc3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

bhav-to-diagram.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
}
9393

9494
#visual-output.error {
95-
background: var(--error-color);
95+
box-shadow: 0 0 0 .25rem var(--error-color) inset;
9696
}
9797

9898
#visual-output.dark {
@@ -263,6 +263,7 @@
263263
return;
264264
}
265265

266+
visualOutput.classList.remove('error');
266267
visualOutput.classList.add('loading');
267268
fetch('https://kroki.io/mermaid/svg', {
268269
method: 'POST',
@@ -272,15 +273,16 @@
272273
.then(response => response.text())
273274
.then(svgMarkup => {
274275
diagramWrapper.innerHTML = svgMarkup;
275-
updateDiagramAppearance();
276-
diagramWrapper.classList.remove('error');
277276
resetView();
278277
})
279278
.catch(error => {
280279
console.error(error);
281-
diagramWrapper.classList.add('error');
280+
visualOutput.classList.add('error');
282281
diagramWrapper.innerHTML = '';
283282
})
283+
.then(() => {
284+
updateDiagramAppearance();
285+
})
284286
.finally(() => {
285287
visualOutput.classList.remove('loading');
286288
});
@@ -360,7 +362,7 @@
360362
000D : 2008 : 00 : FFFE : FFFC : 00000000000000000000000000000000
361363
[semi 0x2008] Report a bug on GitHub or Discord (Attach the BHAV code you've pasted into the tool)
362364
363-
000E : 0002 : 00 : FFFD : 000E : 00000000000000000000000000000000
365+
000E : 0002 : 00 : FFFD : 000F : 00000000000000000000000000000000
364366
[prim 0x0002] Expression (Do you know what the colors of lines with arrows mean?)
365367
366368
000F : 1003 : 00 : 0010 : 0010 : 00000000000000000000000000000000
@@ -720,6 +722,7 @@
720722

721723
let blocksWithIncomingTransitions = blocks
722724
.flatMap(block => block.outgoingTransitions
725+
.filter(transition => block != transition.endBlock)
723726
.map(transition => transition.endBlock)
724727
);
725728

@@ -877,17 +880,17 @@
877880
static #getBlockCode(block, indentSize = 0) {
878881
let indent = this.#getIndent(indentSize);
879882
if (block.isSpecial === true) {
880-
return `${indent}${block.id}[${block.name}]`
883+
return `${indent}${block.id}{{${block.name}}}`
881884
+ `\r\n${indent}class ${block.id} specialBlock`
882885
+ `\r\n${indent}class ${block.id} ${block.type}`
883886
+ '\r\n\r\n';
884887
}
885888

886889
let instanceEmoji = this.#instanceEmojiMap[block.instance] ?? '';
887890

888-
return `${indent}${block.id}["${toHex(block.id)} [${block.type} ${toHex(block.instance, 4)}]`
891+
return `${indent}${block.id}("${toHex(block.id)} [${block.type} ${toHex(block.instance, 4)}]`
889892
+ `<br>${instanceEmoji} <b>${block.name}<\/b>`
890-
+ `<br>${block.description}"]`
893+
+ `<br>${block.description}")`
891894
+ `\r\n${indent}class ${block.id} ${block.type}`
892895
+ '\r\n\r\n';
893896
}

0 commit comments

Comments
 (0)