From 9b1a8c653f007924aec40f61670383e2b05c5d2b Mon Sep 17 00:00:00 2001 From: utensil Date: Thu, 26 Sep 2024 00:12:14 +0800 Subject: [PATCH] Pass biome --- bun/graphviz.js | 17 +++++++++++++---- bun/penrose.js | 6 +++++- bun/typst.js | 17 ++++++++++++----- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/bun/graphviz.js b/bun/graphviz.js index a04a3fc..a2b79f5 100644 --- a/bun/graphviz.js +++ b/bun/graphviz.js @@ -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') @@ -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) } diff --git a/bun/penrose.js b/bun/penrose.js index 0b19de6..2f7ce8c 100644 --- a/bun/penrose.js +++ b/bun/penrose.js @@ -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') } diff --git a/bun/typst.js b/bun/typst.js index 061c394..30f4483 100644 --- a/bun/typst.js +++ b/bun/typst.js @@ -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') @@ -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')