Skip to content

Commit

Permalink
Pass biome
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Sep 25, 2024
1 parent 506fc8f commit 9b1a8c6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
17 changes: 13 additions & 4 deletions bun/graphviz.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

// bun add @hpcc-js/wasm
import { Graphviz } from "@hpcc-js/wasm/graphviz"
import { Graphviz } from '@hpcc-js/wasm/graphviz'

const graphviz = await Graphviz.load()

const possible_layouts = [
'circo', 'dot', 'fdp', 'sfdp', 'neato', 'osage', 'patchwork', 'twopi' // , 'nop', 'nop2'
'circo',
'dot',
'fdp',
'sfdp',
'neato',
'osage',
'patchwork',
'twopi', // , 'nop', 'nop2'
]

const graphviz_roots = document.querySelectorAll('.graphviz-root.loading')
Expand All @@ -14,7 +20,10 @@ for (const graphviz_root of graphviz_roots) {
let layout = graphviz_root.getAttribute('data-layout')
if (!possible_layouts.includes(layout)) {
// randomly choose a layout
layout = possible_layouts[Math.floor(Math.random() * possible_layouts.length)]
layout =
possible_layouts[
Math.floor(Math.random() * possible_layouts.length)
]
console.debug('randomly choose a layout:', layout)
}

Expand Down
6 changes: 5 additions & 1 deletion bun/penrose.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ for (const penrose_root of penrose_roots) {
}

penrose_root.innerHTML = ''
const dia = await Penrose.interactiveDiagram(trio, penrose_root, async () => undefined)
const dia = await Penrose.interactiveDiagram(
trio,
penrose_root,
async () => undefined,
)
penrose_root.classList.remove('loading')
}
17 changes: 12 additions & 5 deletions bun/typst.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ for (const typst_tag of typst_tags) {
typst_src_url = `/${typst_src_url}`
}
const rendered = await $typst.svg({
mainFilePath: typst_src_url, data_selection: {
js: true, css: false, defs: true, body: true
}
mainFilePath: typst_src_url,
data_selection: {
js: true,
css: false,
defs: true,
body: true,
},
})
typst_tag.innerHTML = rendered
typst_tag.classList.remove('loading')
Expand All @@ -85,8 +89,11 @@ for (const typst_tag of typst_tags) {
const rendered = await $typst.svg({
mainContent: typst_source,
data_selection: {
js: true, css: false, defs: true, body: true
}
js: true,
css: false,
defs: true,
body: true,
},
})
typst_tag.innerHTML = rendered
typst_tag.classList.remove('loading')
Expand Down

0 comments on commit 9b1a8c6

Please sign in to comment.