diff --git a/package.json b/package.json index 98f48f04..5bba0eaf 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "dependencies": { "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", - "@excalidraw/excalidraw": "^0.17.0", + "@excalidraw/excalidraw": "^0.17.3", + "@excalidraw/mermaid-to-excalidraw": "^0.3.0", "@mdx-js/mdx": "^2.3.0", "@mdx-js/react": "^2.3.0", "@mui/base": "^5.0.0-alpha.119", @@ -31,7 +32,7 @@ "gray-matter": "^4.0.3", "isomorphic-git": "^1.21.0", "mdast-util-mdx-jsx": "^3.1.2", - "mermaid": "^9.4.0", + "mermaid": "10.9.0", "next": "13.2.1", "next-mdx-remote": "^4.3.0", "next-sitemap": "^3.1.55", @@ -55,6 +56,7 @@ "sass": "^1.58.3", "shiki": "^0.14.1", "svgo": "^3.0.2", + "swr": "^2.2.5", "typescript": "4.9.5", "unified": "^10.1.2", "unist-util-visit": "^4.1.2" diff --git a/public/content/articles/2021-03-21-Handy-heap-cheat-sheet.md b/public/content/articles/2021-03-21-Handy-heap-cheat-sheet.md index 7da59503..1f68bd7f 100644 --- a/public/content/articles/2021-03-21-Handy-heap-cheat-sheet.md +++ b/public/content/articles/2021-03-21-Handy-heap-cheat-sheet.md @@ -1,6 +1,6 @@ --- created_at: 2021-08-28 23:09:14 -updated_at: 2022-03-27 21:30:33+08:00 +updated_at: 2024-04-14 21:30:33+08:00 layout: post title: "如何手撕一个堆" subtitle: "如果哪一天你把编程语言的类库全忘光了,又遇到一题明知到要用堆的题目,咋办?对着一道自己明显会的题干着急,愣是想不起PriorityQueue的名字。这时候只能自己实现一个堆出来了。" @@ -95,11 +95,13 @@ $$T(i) = logi$$ 那么把所有元素上浮,则总时间复杂度为: -$$\begin{aligned} +$$ +\begin{aligned} T(n) &= \sum_{i=1}^{n}logi\\ &= 1\times0 + 2\times1 + ... + 2^{logn}\times{logn} \\ &=O(nlogn) -\end{aligned}$$ +\end{aligned} +$$ 通过把元素逐个入堆来建堆时,元素的时间复杂度可以用下图直观显示: @@ -115,15 +117,19 @@ T(n) &= \sum_{i=1}^{n}logi\\ 下沉第i个元素(从顶到底数)时,以其为顶点的树高度约为$logn-logi$,则有下沉时间复杂度为: -$$T(i) = logn-logi$$ +$$ +T(i) = logn-logi +$$ 那么把所有元素下沉,则总时间复杂度为: -$$\begin{aligned} +$$ +\begin{aligned} T(n) &= \sum_{i=1}^{n}logn-logi \\ &= \frac{n}{2^{logn}}\times{logn}+ ... + \frac{n}{4}\times2+\frac{n}{2}\times1 \\ &= O(n) -\end{aligned}$$ +\end{aligned} +$$ 同样的,我们也可以把逐个元素下沉所耗费的时间用下图来示意: diff --git a/public/content/ideas/blog-syntax.md b/public/content/ideas/blog-syntax.md index 524a8e8f..9c25c8eb 100644 --- a/public/content/ideas/blog-syntax.md +++ b/public/content/ideas/blog-syntax.md @@ -64,6 +64,12 @@ def func_echo(s: str): ``` ```` +行内反引号围栏: `` ` `` 或者 ``` `` ``` 的模式 + +```markdown +`段落反引号内的行内反引号` +``` + ## 列表 - 无序列表 diff --git a/src/components/ExcalidrawScene/EmbededExcalidraw.tsx b/src/components/ExcalidrawScene/EmbededExcalidraw.tsx index a2a6522b..dce41825 100644 --- a/src/components/ExcalidrawScene/EmbededExcalidraw.tsx +++ b/src/components/ExcalidrawScene/EmbededExcalidraw.tsx @@ -1,13 +1,6 @@ import { ExcalidrawElement } from "@excalidraw/excalidraw/types/element/types"; -import dynamic from "next/dynamic"; -import { useEffect, useState } from "react"; - -const ExcalidrawScene = dynamic( - async () => (await import("./index")).ExcalidrawScene, - { - ssr: false, - } -); +import useSWR from "swr"; +import { ExcalidrawScene } from "./ExcalidrawScene"; export type EmbededExcalidrawProps = { file: string; @@ -20,13 +13,19 @@ export default function EmbededExcalidraw({ url, label, }: EmbededExcalidrawProps) { - const [elements, setElements] = useState([]); - useEffect(() => { - fetch(url) - .then((res) => res.json()) - .then((data) => { - setElements(data.elements); - }); - }, [file, url, label]); - return ; + const { data: refData, isLoading } = useSWR(url, async (url) => { + const res = await fetch(url).then((res) => res.json()); + return res.elements as ExcalidrawElement[]; + }); + return ( +
+ {isLoading ? ( +
+ Loading... +
+ ) : ( + + )} +
+ ); } diff --git a/src/components/ExcalidrawScene/ExcalidrawScene.tsx b/src/components/ExcalidrawScene/ExcalidrawScene.tsx new file mode 100644 index 00000000..04d63677 --- /dev/null +++ b/src/components/ExcalidrawScene/ExcalidrawScene.tsx @@ -0,0 +1,8 @@ +import dynamic from "next/dynamic"; + +export const ExcalidrawScene = dynamic( + async () => (await import("./ExcalidrawSceneImpl")).ExcalidrawSceneImpl, + { + ssr: false, + } +); diff --git a/src/components/ExcalidrawScene/index.tsx b/src/components/ExcalidrawScene/ExcalidrawSceneImpl.tsx similarity index 54% rename from src/components/ExcalidrawScene/index.tsx rename to src/components/ExcalidrawScene/ExcalidrawSceneImpl.tsx index aed2c73d..4327d8a3 100644 --- a/src/components/ExcalidrawScene/index.tsx +++ b/src/components/ExcalidrawScene/ExcalidrawSceneImpl.tsx @@ -1,15 +1,18 @@ "use client"; import { Excalidraw } from "@excalidraw/excalidraw"; import { ExcalidrawElement } from "@excalidraw/excalidraw/types/element/types"; +import { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types/types"; +import { useRef } from "react"; type ExcalidrawSceneProps = { elements: ExcalidrawElement[]; }; -export function ExcalidrawScene({ elements }: ExcalidrawSceneProps) { +export function ExcalidrawSceneImpl({ elements }: ExcalidrawSceneProps) { + const excalidrawAPIRef = useRef(); return ( <> -
+
{ + excalidrawAPIRef.current = api; + + setTimeout(() => { + api.scrollToContent(undefined, { fitToContent: true }); + }, 1000); + }} >
diff --git a/src/components/ExcalidrawScene/MermaidCodeBlock.tsx b/src/components/ExcalidrawScene/MermaidCodeBlock.tsx new file mode 100644 index 00000000..e6f9a3f8 --- /dev/null +++ b/src/components/ExcalidrawScene/MermaidCodeBlock.tsx @@ -0,0 +1,6 @@ +import dynamic from "next/dynamic"; + +export const MermaidCodeBlock = dynamic( + async () => (await import("./MermaidCodeBlockImpl")).MermaidCodeBlockImpl, + { ssr: false } +); diff --git a/src/components/ExcalidrawScene/MermaidCodeBlockImpl.tsx b/src/components/ExcalidrawScene/MermaidCodeBlockImpl.tsx new file mode 100644 index 00000000..08fb25b4 --- /dev/null +++ b/src/components/ExcalidrawScene/MermaidCodeBlockImpl.tsx @@ -0,0 +1,54 @@ +"use client"; +import { convertToExcalidrawElements } from "@excalidraw/excalidraw"; +import { ExcalidrawElement } from "@excalidraw/excalidraw/types/element/types"; +import { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw"; +import { useEffect, useState } from "react"; +import { ExcalidrawSceneImpl } from "./ExcalidrawSceneImpl"; + +export type MermaidCodeBlockProps = { + name?: string; + children: string; + className?: string; +}; +export function MermaidCodeBlockImpl({ + name = "mermaid", + children, + className, +}: MermaidCodeBlockProps) { + console.log(children); + const [elements, setElements] = useState([]); + const [parseDone, setParseDone] = useState(false); + useEffect(() => { + const parseMermaid = async () => { + if (parseDone) return; + try { + const { elements: elementSkeletons } = await parseMermaidToExcalidraw( + children, + {} + ); + const excalidrawElements = + convertToExcalidrawElements(elementSkeletons); + setElements(excalidrawElements); + setParseDone(true); + console.log("elements", excalidrawElements); + } catch (e) { + console.error("error", e); + } + }; + + parseMermaid(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [children, parseDone]); + + return ( +
+ {parseDone ? ( + + ) : ( +
+ Loading... +
+ )} +
+ ); +} diff --git a/src/components/Mermaid/index.tsx b/src/components/Mermaid/index.tsx index 9f817d33..9dbee1d6 100644 --- a/src/components/Mermaid/index.tsx +++ b/src/components/Mermaid/index.tsx @@ -1,34 +1,32 @@ "use client"; +export {}; -import mermaid from "mermaid"; -import React, { useEffect, useLayoutEffect, useMemo } from "react"; +// // mermaid.init({ +// // startOnLoad: false, +// // }); -mermaid.init({ - startOnLoad: false, -}); +// type MermaidProps = { +// name?: string; +// children: string; +// className?: string; +// }; -type MermaidProps = { - name?: string; - children: string; - className?: string; -}; +// const Mermaid = ({ name = "mermaid", children, className }: MermaidProps) => { +// const [svg, setSvg] = React.useState(""); +// useEffect(() => { +// const res = mermaid.render(name, children); +// setSvg(res); +// }, [name, children]); -const Mermaid = ({ name = "mermaid", children, className }: MermaidProps) => { - const [svg, setSvg] = React.useState(""); - useEffect(() => { - const res = mermaid.render(name, children); - setSvg(res); - }, [name, children]); +// // TODO maybe caculate simple size and set default size +// return svg === "" ? ( +// {children} +// ) : ( +//
+// ); +// }; - // TODO maybe caculate simple size and set default size - return svg === "" ? ( - {children} - ) : ( -
- ); -}; - -export default Mermaid; +// export default Mermaid; diff --git a/src/components/index.tsx b/src/components/index.tsx index f700faf1..0ae20546 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -11,6 +11,7 @@ import { import { MDXComponents } from "mdx/types"; import { Bar } from "react-chartjs-2"; import EmbededExcalidraw from "./ExcalidrawScene/EmbededExcalidraw"; +import { MermaidCodeBlock } from "./ExcalidrawScene/MermaidCodeBlock"; import License from "./License"; ChartJS.register( @@ -26,6 +27,7 @@ const components: MDXComponents = { Bar, // Mermaid, License, + MermaidCodeBlock, ObsidianRich: (props: ObsidianRichProps) => { console.log("ObsidianRich:", props); if ( diff --git a/src/plugins/index.ts b/src/plugins/index.ts index badcfe6d..da112c33 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -8,7 +8,7 @@ import rehypeSlug from "rehype-slug"; import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; import remarkUnwrapImages from "remark-unwrap-images"; -import remarkMermaid from "./remark-mermaid"; +import remarkExcalidrawMermaid from "./remark-excalidraw-mermaid"; import remarkObsidianRich, { RemarkObsidianRichOptions, } from "./remark-obsidian-rich"; @@ -24,7 +24,8 @@ const parseMdx = async (content: string, config?: ParseMdxConfig) => { remarkPlugins: [ remarkGfm, remarkMath, - [remarkMermaid, { wrap: true, className: ["mermaid"] }], + remarkExcalidrawMermaid, + // [remarkMermaid, { wrap: true, className: ["mermaid"] }], [remarkObsidianRich, config?.remarkObsidianRichOptions], remarkUnwrapImages, ], diff --git a/src/plugins/remark-excalidraw-mermaid.ts b/src/plugins/remark-excalidraw-mermaid.ts new file mode 100644 index 00000000..a0e8c3ba --- /dev/null +++ b/src/plugins/remark-excalidraw-mermaid.ts @@ -0,0 +1,55 @@ +import { is } from "unist-util-is"; +import { visit } from "unist-util-visit"; + +import { MermaidCodeBlockProps } from "@/components/ExcalidrawScene/MermaidCodeBlockImpl"; +import type { Code } from "mdast"; +import { MdxJsxFlowElement } from "mdast-util-mdx-jsx/lib"; +import type { Plugin, Transformer } from "unified"; +import type { Node, Parent } from "unist"; +import type { VFileCompatible } from "vfile"; + +export interface RemarkExcalidrawMermaidOptions {} + +function isMermaid(node: unknown): node is Code { + if (!is(node, { type: "code", lang: "mermaid" })) { + return false; + } + return true; +} + +const parseMermaidProp = (node: Code): MermaidCodeBlockProps => { + return { + children: node.value, + }; +}; + +const remarkExcalidrawMermaid: Plugin<[RemarkExcalidrawMermaidOptions?]> = + function mermaidTrans(options): Transformer { + return async (node: Node, _file: VFileCompatible) => { + visit(node, isMermaid, (node: Code, index: number, parent: Parent) => { + const props = parseMermaidProp(node); + const mermaidRichElement: MdxJsxFlowElement = { + type: "mdxJsxFlowElement", + name: "MermaidCodeBlock", + attributes: [ + { type: "mdxJsxAttribute", name: "name", value: props.name }, + { + type: "mdxJsxAttribute", + name: "children", + value: props.children, + }, + { + type: "mdxJsxAttribute", + name: "className", + value: props.className, + }, + ], + children: [], + }; + + parent.children.splice(index, 1, mermaidRichElement); + }); + }; + }; + +export default remarkExcalidrawMermaid; diff --git a/src/plugins/remark-mermaid.ts b/src/plugins/remark-mermaid.ts index 0b478fe1..e4583ad7 100644 --- a/src/plugins/remark-mermaid.ts +++ b/src/plugins/remark-mermaid.ts @@ -1,237 +1,238 @@ -import * as playwright from "playwright"; -import rehypeParse from "rehype-parse"; -import { optimize } from "svgo"; -import { unified } from "unified"; -import { is } from "unist-util-is"; -import { visit } from "unist-util-visit"; - -import type { Code, Paragraph } from "mdast"; -import type Mermaid from "mermaid"; -import type { MermaidConfig } from "mermaid"; -import type { Config as SvgoConfig } from "svgo"; -import type { Plugin, Transformer } from "unified"; -import type { Node, Parent } from "unist"; -import type { VFileCompatible } from "vfile"; - -// copy from https://github.com/haxibami/haxibami.net - -function isObject(target: unknown): target is { [key: string]: unknown } { - return typeof target === "object" && target !== null; -} - -function isParent(node: unknown): node is Parent { - return isObject(node) && Array.isArray(node.children); -} - -// we want to check types for browser-executed mermaid codes, but don't want to "import" any mermaid modules in them. -declare const mermaid: typeof Mermaid; - -export const UserTheme = { - Forest: "forest", - Dark: "dark", - Default: "default", - Neutral: "neutral", - Null: "null", -} as const; - -export type Theme = (typeof UserTheme)[keyof typeof UserTheme]; - -export interface RemarkMermaidOptions { - /** - * Launch options to pass to playwright. - * - * @default {} - */ - launchOptions?: playwright.LaunchOptions; - - /** - * The Mermaid theme to use. - * - * @default 'default' - */ - theme?: Theme; - - /** - * Whether to wrap svg with
element. - * - * @default "false" - */ - wrap?: boolean; - - /** - * When wrapping with
, you can choose what classname to add. - * @default [] - */ - className?: string[]; -} - -function svgParse(svg: string): Node { - const processor = unified().use(rehypeParse, { fragment: true }); - const ast = processor.parse(svg); - // console.log("pafter process", ast); - return ast; -} - -function isMermaid(node: unknown): node is Code { - if (!is(node, { type: "code", lang: "mermaid" })) { - return false; - } - return true; -} - -type MermaidBlock = [Code, number, Parent]; - -const remarkMermaid: Plugin<[RemarkMermaidOptions?]> = function mermaidTrans( - options -): Transformer { - const DEFAULT_SETTINGS = { - launchOptions: { - args: ["--no-sandbox", "--disable-setuid-sandbox"], - }, - theme: "default", - wrap: false, - className: [], - }; - - const settings = Object.assign({}, DEFAULT_SETTINGS, options); - - return async (node: Node, _file: VFileCompatible) => { - const mermaidBlocks = getMermaidBlocks(node); - if (mermaidBlocks.length === 0) { - return; - } - const browser = await playwright.chromium.launch(settings.launchOptions); - const context = await browser.newContext({ - viewport: { width: 1000, height: 3000 }, - }); - const page = await context.newPage(); - await page.setContent(``); - await page.addScriptTag({ - url: "https://unpkg.com/mermaid@9/dist/mermaid.min.js", - type: "module", - }); - // await page.setViewportSize({ width: 1000, height: 3000 }); - const svgResults = await page.evaluate( - ({ blocks, theme }) => { - const config: MermaidConfig = { - theme: theme, - startOnLoad: false, - - /** - * setting htmlLabels to false - * to prevent mermaid svg containing html tags - * which will be styled by css - * and cause the text in svg to be cut off - * NOTE: maybe other type of chart would be affected too - * then change that type of chart to htmlLabels: true - */ - flowchart: { htmlLabels: false }, - }; - mermaid.mermaidAPI.initialize(config); - return blocks.map(([code, ,], id) => { - const svg = mermaid.mermaidAPI.render(`mermaid-${id}`, code.value); - return svg; - }); - }, - { blocks: mermaidBlocks, theme: settings.theme } - ); - await browser.close(); - - mermaidBlocks.forEach(([, index, parent], i) => { - const svgAst = svgParse(optSvg(svgResults[i])); - if (settings.wrap) { - parent.children[index] = { - type: "parent", - children: [], - data: { - hChildren: [ - { - type: "element", - children: [svgAst], - tagName: "div", - properties: { - className: settings.className, - }, - }, - ], - }, - } as Parent; - } else { - parent.children[index] = { - type: "paragraph", - children: [], - data: { - hChildren: [svgAst], - }, - } as Paragraph; - } - }); - }; -}; - -function getMermaidBlocks(node: Node): MermaidBlock[] { - const blocks: MermaidBlock[] = []; - - visit( - node, - isMermaid, - (node: Code, index: number, parent: Parent | undefined) => { - if (!isParent(parent)) { - return; - } - blocks.push([node, index, parent]); - } - ); - - return blocks; -} - -function optSvg(svg: string) { - // console.log("before opt svg", svg); - const svgoOptions: SvgoConfig = { - js2svg: { - indent: 2, - pretty: true, - }, - multipass: false, - plugins: [ - { - name: "preset-default", - params: { - overrides: { - cleanupEnableBackground: false, - convertShapeToPath: false, - inlineStyles: { - onlyMatchedOnce: false, - }, - moveElemsAttrsToGroup: false, - moveGroupAttrsToElems: false, - removeEmptyAttrs: false, - removeUselessStrokeAndFill: { - removeNone: true, - }, - }, - }, - }, - "convertStyleToAttrs", - "removeOffCanvasPaths", - "removeRasterImages", - "removeScriptElement", - "removeStyleElement", - "removeXMLNS", - "reusePaths", - { - name: "removeAttrs", - params: { - attrs: ["class"], - }, - }, - ], - }; - - const value = optimize(svg, svgoOptions).data; - // console.log("after opt svg", value); - return value; -} - -export default remarkMermaid; +export {}; +// import * as playwright from "playwright"; +// import rehypeParse from "rehype-parse"; +// import { optimize } from "svgo"; +// import { unified } from "unified"; +// import { is } from "unist-util-is"; +// import { visit } from "unist-util-visit"; + +// import type { Code, Paragraph } from "mdast"; +// import type Mermaid from "mermaid"; +// import type { MermaidConfig } from "mermaid"; +// import type { Config as SvgoConfig } from "svgo"; +// import type { Plugin, Transformer } from "unified"; +// import type { Node, Parent } from "unist"; +// import type { VFileCompatible } from "vfile"; + +// // copy from https://github.com/haxibami/haxibami.net + +// function isObject(target: unknown): target is { [key: string]: unknown } { +// return typeof target === "object" && target !== null; +// } + +// function isParent(node: unknown): node is Parent { +// return isObject(node) && Array.isArray(node.children); +// } + +// // we want to check types for browser-executed mermaid codes, but don't want to "import" any mermaid modules in them. +// declare const mermaid: typeof Mermaid; + +// export const UserTheme = { +// Forest: "forest", +// Dark: "dark", +// Default: "default", +// Neutral: "neutral", +// Null: "null", +// } as const; + +// export type Theme = (typeof UserTheme)[keyof typeof UserTheme]; + +// export interface RemarkMermaidOptions { +// /** +// * Launch options to pass to playwright. +// * +// * @default {} +// */ +// launchOptions?: playwright.LaunchOptions; + +// /** +// * The Mermaid theme to use. +// * +// * @default 'default' +// */ +// theme?: Theme; + +// /** +// * Whether to wrap svg with
element. +// * +// * @default "false" +// */ +// wrap?: boolean; + +// /** +// * When wrapping with
, you can choose what classname to add. +// * @default [] +// */ +// className?: string[]; +// } + +// function svgParse(svg: string): Node { +// const processor = unified().use(rehypeParse, { fragment: true }); +// const ast = processor.parse(svg); +// // console.log("pafter process", ast); +// return ast; +// } + +// function isMermaid(node: unknown): node is Code { +// if (!is(node, { type: "code", lang: "mermaid" })) { +// return false; +// } +// return true; +// } + +// type MermaidBlock = [Code, number, Parent]; + +// const remarkMermaid: Plugin<[RemarkMermaidOptions?]> = function mermaidTrans( +// options +// ): Transformer { +// const DEFAULT_SETTINGS = { +// launchOptions: { +// args: ["--no-sandbox", "--disable-setuid-sandbox"], +// }, +// theme: "default", +// wrap: false, +// className: [], +// }; + +// const settings = Object.assign({}, DEFAULT_SETTINGS, options); + +// return async (node: Node, _file: VFileCompatible) => { +// const mermaidBlocks = getMermaidBlocks(node); +// if (mermaidBlocks.length === 0) { +// return; +// } +// const browser = await playwright.chromium.launch(settings.launchOptions); +// const context = await browser.newContext({ +// viewport: { width: 1000, height: 3000 }, +// }); +// const page = await context.newPage(); +// await page.setContent(``); +// await page.addScriptTag({ +// url: "https://unpkg.com/mermaid@9/dist/mermaid.min.js", +// type: "module", +// }); +// // await page.setViewportSize({ width: 1000, height: 3000 }); +// const svgResults = await page.evaluate( +// ({ blocks, theme }) => { +// const config: MermaidConfig = { +// theme: theme, +// startOnLoad: false, + +// /** +// * setting htmlLabels to false +// * to prevent mermaid svg containing html tags +// * which will be styled by css +// * and cause the text in svg to be cut off +// * NOTE: maybe other type of chart would be affected too +// * then change that type of chart to htmlLabels: true +// */ +// flowchart: { htmlLabels: false }, +// }; +// mermaid.mermaidAPI.initialize(config); +// return blocks.map(([code, ,], id) => { +// const svg = mermaid.mermaidAPI.render(`mermaid-${id}`, code.value); +// return svg; +// }); +// }, +// { blocks: mermaidBlocks, theme: settings.theme } +// ); +// await browser.close(); + +// mermaidBlocks.forEach(([, index, parent], i) => { +// const svgAst = svgParse(optSvg(svgResults[i])); +// if (settings.wrap) { +// parent.children[index] = { +// type: "parent", +// children: [], +// data: { +// hChildren: [ +// { +// type: "element", +// children: [svgAst], +// tagName: "div", +// properties: { +// className: settings.className, +// }, +// }, +// ], +// }, +// } as Parent; +// } else { +// parent.children[index] = { +// type: "paragraph", +// children: [], +// data: { +// hChildren: [svgAst], +// }, +// } as Paragraph; +// } +// }); +// }; +// }; + +// function getMermaidBlocks(node: Node): MermaidBlock[] { +// const blocks: MermaidBlock[] = []; + +// visit( +// node, +// isMermaid, +// (node: Code, index: number, parent: Parent | undefined) => { +// if (!isParent(parent)) { +// return; +// } +// blocks.push([node, index, parent]); +// } +// ); + +// return blocks; +// } + +// function optSvg(svg: string) { +// // console.log("before opt svg", svg); +// const svgoOptions: SvgoConfig = { +// js2svg: { +// indent: 2, +// pretty: true, +// }, +// multipass: false, +// plugins: [ +// { +// name: "preset-default", +// params: { +// overrides: { +// cleanupEnableBackground: false, +// convertShapeToPath: false, +// inlineStyles: { +// onlyMatchedOnce: false, +// }, +// moveElemsAttrsToGroup: false, +// moveGroupAttrsToElems: false, +// removeEmptyAttrs: false, +// removeUselessStrokeAndFill: { +// removeNone: true, +// }, +// }, +// }, +// }, +// "convertStyleToAttrs", +// "removeOffCanvasPaths", +// "removeRasterImages", +// "removeScriptElement", +// "removeStyleElement", +// "removeXMLNS", +// "reusePaths", +// { +// name: "removeAttrs", +// params: { +// attrs: ["class"], +// }, +// }, +// ], +// }; + +// const value = optimize(svg, svgoOptions).data; +// // console.log("after opt svg", value); +// return value; +// } + +// export default remarkMermaid; diff --git a/src/plugins/remark-obsidian-rich.ts b/src/plugins/remark-obsidian-rich.ts index 34b3f8c7..7b0f9932 100644 --- a/src/plugins/remark-obsidian-rich.ts +++ b/src/plugins/remark-obsidian-rich.ts @@ -103,7 +103,6 @@ const remarkObsidianRich: unified.Plugin<[RemarkObsidianRichOptions?]> = ( ) => { const opts = { ...DEFAULT_OPTIONS, ...options }; return (tree) => { - const promises: Promise[] = []; visit( tree, isObsidianRich, diff --git a/yarn.lock b/yarn.lock index 1563eaeb..82b96a7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -310,10 +310,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@braintree/sanitize-url@^6.0.0": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.2.tgz#6110f918d273fe2af8ea1c4398a88774bb9fc12f" - integrity sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg== +"@braintree/sanitize-url@^6.0.1": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783" + integrity sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A== "@corex/deepmerge@^4.0.29": version "4.0.37" @@ -447,11 +447,25 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.35.0.tgz#b7569632b0b788a0ca0e438235154e45d42813a7" integrity sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw== -"@excalidraw/excalidraw@^0.17.5": +"@excalidraw/excalidraw@^0.17.3": version "0.17.5" resolved "https://registry.yarnpkg.com/@excalidraw/excalidraw/-/excalidraw-0.17.5.tgz#1afcee7601f36aba36cba828211e3b6c6edd50e2" integrity sha512-XtFtzhQvt5g8quj1KmVQ6LBgv3M5WGDOm50dTcQz9Royc6AImh2X1Zw6ULcsujsjMFFBbG46nJLELsd/6yLlIw== +"@excalidraw/markdown-to-text@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@excalidraw/markdown-to-text/-/markdown-to-text-0.1.2.tgz#1703705e7da608cf478f17bfe96fb295f55a23eb" + integrity sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg== + +"@excalidraw/mermaid-to-excalidraw@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@excalidraw/mermaid-to-excalidraw/-/mermaid-to-excalidraw-0.3.0.tgz#94c438133fc66db6b920e237abda5152b62e6cb0" + integrity sha512-eyFN8y2ES3HFtETZWZZBakkSB5ROfnHJeCLeBlMgrIk1fxbXpPtxlu2VwGNpqPjDiCfV5FYnx7FaZ4CRiVRVMg== + dependencies: + "@excalidraw/markdown-to-text" "0.1.2" + mermaid "10.9.0" + nanoid "4.0.2" + "@humanwhocodes/config-array@^0.11.8": version "0.11.8" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" @@ -1113,6 +1127,23 @@ dependencies: "@babel/types" "^7.3.0" +"@types/d3-scale-chromatic@^3.0.0": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz#fc0db9c10e789c351f4c42d96f31f2e4df8f5644" + integrity sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw== + +"@types/d3-scale@^4.0.3": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-4.0.8.tgz#d409b5f9dcf63074464bf8ddfb8ee5a1f95945bb" + integrity sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ== + dependencies: + "@types/d3-time" "*" + +"@types/d3-time@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-3.0.3.tgz#3c186bbd9d12b9d84253b6be6487ca56b54f88be" + integrity sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw== + "@types/debug@^4.0.0": version "4.1.7" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" @@ -1941,7 +1972,7 @@ clean-git-ref@^2.0.1: resolved "https://registry.yarnpkg.com/clean-git-ref/-/clean-git-ref-2.0.1.tgz#dcc0ca093b90e527e67adb5a5e55b1af6816dcd9" integrity sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw== -client-only@0.0.1: +client-only@0.0.1, client-only@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== @@ -2016,7 +2047,7 @@ commander@7, commander@^7.2.0: resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== -commander@^8.0.0: +commander@^8.0.0, commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== @@ -2043,13 +2074,6 @@ cose-base@^1.0.0: dependencies: layout-base "^1.0.0" -cose-base@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-2.2.0.tgz#1c395c35b6e10bb83f9769ca8b817d614add5c01" - integrity sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g== - dependencies: - layout-base "^2.0.0" - cosmiconfig@8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.0.0.tgz#e9feae014eab580f858f8a0288f38997a7bebe97" @@ -2170,21 +2194,21 @@ cytoscape-cose-bilkent@^4.1.0: dependencies: cose-base "^1.0.0" -cytoscape-fcose@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cytoscape-fcose/-/cytoscape-fcose-2.2.0.tgz#e4d6f6490df4fab58ae9cea9e5c3ab8d7472f471" - integrity sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ== - dependencies: - cose-base "^2.2.0" - -cytoscape@^3.23.0: - version "3.23.0" - resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.23.0.tgz#054ee05a6d0aa3b4f139382bbf2f4e5226df3c6d" - integrity sha512-gRZqJj/1kiAVPkrVFvz/GccxsXhF3Qwpptl32gKKypO4IlqnKBjTOu+HbXtEggSGzC5KCaHp3/F7GgENrtsFkA== +cytoscape@^3.28.1: + version "3.28.1" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.28.1.tgz#f32c3e009bdf32d47845a16a4cd2be2bbc01baf7" + integrity sha512-xyItz4O/4zp9/239wCcH8ZcFuuZooEeF8KHRmzjDfGdXsj3OG9MFSMA0pJE0uX3uCN/ygof6hHf4L7lst+JaDg== dependencies: heap "^0.2.6" lodash "^4.17.21" +"d3-array@1 - 2": + version "2.12.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" + integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== + dependencies: + internmap "^1.0.0" + "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.2.tgz#f8ac4705c5b06914a7e0025bbf8d5f1513f6a86e" @@ -2301,6 +2325,11 @@ d3-hierarchy@3: dependencies: d3-color "1 - 3" +d3-path@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf" + integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== + "d3-path@1 - 3", d3-path@3, d3-path@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-3.1.0.tgz#22df939032fb5a71ae8b1800d61ddb7851c42526" @@ -2321,6 +2350,14 @@ d3-random@3: resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-3.0.1.tgz#d4926378d333d9c0bfd1e6fa0194d30aebaa20f4" integrity sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ== +d3-sankey@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/d3-sankey/-/d3-sankey-0.12.3.tgz#b3c268627bd72e5d80336e8de6acbfec9d15d01d" + integrity sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ== + dependencies: + d3-array "1 - 2" + d3-shape "^1.2.0" + d3-scale-chromatic@3: version "3.0.0" resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz#15b4ceb8ca2bb0dcb6d1a641ee03d59c3b62376a" @@ -2352,6 +2389,13 @@ d3-shape@3: dependencies: d3-path "^3.1.0" +d3-shape@^1.2.0: + version "1.3.7" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7" + integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== + dependencies: + d3-path "1" + "d3-time-format@2 - 4", d3-time-format@4: version "4.1.0" resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.1.0.tgz#7ab5257a5041d11ecb4fe70a5c7d16a195bb408a" @@ -2393,7 +2437,43 @@ d3-zoom@3: d3-selection "2 - 3" d3-transition "2 - 3" -d3@^7.0.0, d3@^7.8.2: +d3@^7.4.0: + version "7.9.0" + resolved "https://registry.yarnpkg.com/d3/-/d3-7.9.0.tgz#579e7acb3d749caf8860bd1741ae8d371070cd5d" + integrity sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA== + dependencies: + d3-array "3" + d3-axis "3" + d3-brush "3" + d3-chord "3" + d3-color "3" + d3-contour "4" + d3-delaunay "6" + d3-dispatch "3" + d3-drag "3" + d3-dsv "3" + d3-ease "3" + d3-fetch "3" + d3-force "3" + d3-format "3" + d3-geo "3" + d3-hierarchy "3" + d3-interpolate "3" + d3-path "3" + d3-polygon "3" + d3-quadtree "3" + d3-random "3" + d3-scale "4" + d3-scale-chromatic "3" + d3-selection "3" + d3-shape "3" + d3-time "3" + d3-time-format "4" + d3-timer "3" + d3-transition "3" + d3-zoom "3" + +d3@^7.8.2: version "7.8.2" resolved "https://registry.yarnpkg.com/d3/-/d3-7.8.2.tgz#2bdb3c178d095ae03b107a18837ae049838e372d" integrity sha512-WXty7qOGSHb7HR7CfOzwN1Gw04MUOzN8qh9ZUsvwycIMb4DYMpY9xczZ6jUorGtO6bR9BPMPaueIKwiDxu9uiQ== @@ -2429,10 +2509,10 @@ d3@^7.0.0, d3@^7.8.2: d3-transition "3" d3-zoom "3" -dagre-d3-es@7.0.8: - version "7.0.8" - resolved "https://registry.yarnpkg.com/dagre-d3-es/-/dagre-d3-es-7.0.8.tgz#14c309c3c08ba8329a7cf51000bd56a369c513d1" - integrity sha512-eykdoYQ4FwCJinEYS0gPL2f2w+BPbSLvnQSJ3Ye1vAoPjdkq6xIMKBv+UkICd3qZE26wBKIn3p+6n0QC7R1LyA== +dagre-d3-es@7.0.10: + version "7.0.10" + resolved "https://registry.yarnpkg.com/dagre-d3-es/-/dagre-d3-es-7.0.10.tgz#19800d4be674379a3cd8c86a8216a2ac6827cadc" + integrity sha512-qTCQmEhcynucuaZgY5/+ti3X/rnszKZhEQH/ZdWdtP1tA/y3VoHJzcVrO9pjjJCNpigfscAtoUB5ONcd2wNn0A== dependencies: d3 "^7.8.2" lodash-es "^4.17.21" @@ -2680,10 +2760,10 @@ domhandler@^5.0.1, domhandler@^5.0.2: dependencies: domelementtype "^2.3.0" -dompurify@2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.3.tgz#f4133af0e6a50297fc8874e2eaedc13a3c308c03" - integrity sha512-q6QaLcakcRjebxjg8/+NP+h0rPfatOgOzc46Fst9VAA3jF2ApfKBNKMzdP4DYTqtUMXSCd5pRS/8Po/OmoCHZQ== +dompurify@^3.0.5: + version "3.1.0" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.0.tgz#8c6b9fe986969a33aa4686bd829cbe8e14dd9445" + integrity sha512-yoU4rhgPKCo+p5UrWWWNKiIq+ToGqmVVhk0PmMYBK4kRsR3/qhemNFL8f6CFmBd4gMwm3F4T7HBoydP5uY07fA== domutils@^3.0.1: version "3.0.1" @@ -2699,10 +2779,10 @@ electron-to-chromium@^1.4.251, electron-to-chromium@^1.4.284: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== -elkjs@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.8.2.tgz#c37763c5a3e24e042e318455e0147c912a7c248e" - integrity sha512-L6uRgvZTH+4OF5NE/MBbzQx/WYpru1xCBE9respNj6qznEewGUIfhzmm7horWWxbNO2M0WckQypGctR8lH79xQ== +elkjs@^0.9.0: + version "0.9.2" + resolved "https://registry.yarnpkg.com/elkjs/-/elkjs-0.9.2.tgz#3d4ef6f17fde06a5d7eaa3063bb875e25e59e972" + integrity sha512-2Y/RaA1pdgSHpY0YG4TYuYCD2wh97CRvu22eLG3Kz0pgQ/6KbIFTxsTnDc4MH/6hFlg2L/9qXrDMG0nMjP63iw== emittery@^0.13.1: version "0.13.1" @@ -3882,6 +3962,11 @@ internal-slot@^1.0.3, internal-slot@^1.0.4: resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== + is-alphabetical@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz#9e7d6b94916be22153745d184c298cbf986a686d" @@ -4763,6 +4848,13 @@ katex@^0.15.0: dependencies: commander "^8.0.0" +katex@^0.16.9: + version "0.16.10" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.10.tgz#6f81b71ac37ff4ec7556861160f53bc5f058b185" + integrity sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA== + dependencies: + commander "^8.3.0" + khroma@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/khroma/-/khroma-2.0.0.tgz#7577de98aed9f36c7a474c4d453d94c0d6c6588b" @@ -4800,11 +4892,6 @@ layout-base@^1.0.0: resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-1.0.2.tgz#1291e296883c322a9dd4c5dd82063721b53e26e2" integrity sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg== -layout-base@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-2.0.1.tgz#d0337913586c90f9c2c075292069f5c2da5dd285" - integrity sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg== - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -4965,6 +5052,24 @@ mdast-util-from-markdown@^1.0.0: unist-util-stringify-position "^3.0.0" uvu "^0.5.0" +mdast-util-from-markdown@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz#9421a5a247f10d31d2faed2a30df5ec89ceafcf0" + integrity sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww== + dependencies: + "@types/mdast" "^3.0.0" + "@types/unist" "^2.0.0" + decode-named-character-reference "^1.0.0" + mdast-util-to-string "^3.1.0" + micromark "^3.0.0" + micromark-util-decode-numeric-character-reference "^1.0.0" + micromark-util-decode-string "^1.0.0" + micromark-util-normalize-identifier "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + unist-util-stringify-position "^3.0.0" + uvu "^0.5.0" + mdast-util-from-markdown@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz#52f14815ec291ed061f2922fd14d6689c810cb88" @@ -5209,26 +5314,31 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -mermaid@^9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-9.4.0.tgz#ff9afcac9f565a358fa8fc39135dec2c842c3b8f" - integrity sha512-4PWbOND7CNRbjHrdG3WUUGBreKAFVnMhdlPjttuUkeHbCQmAHkwzSh5dGwbrKmXGRaR4uTvfFVYzUcg++h0DkA== +mermaid@10.9.0: + version "10.9.0" + resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.9.0.tgz#4d1272fbe434bd8f3c2c150554dc8a23a9bf9361" + integrity sha512-swZju0hFox/B/qoLKK0rOxxgh8Cf7rJSfAUc1u8fezVihYMvrJAS45GzAxTVf4Q+xn9uMgitBcmWk7nWGXOs/g== dependencies: - "@braintree/sanitize-url" "^6.0.0" - cytoscape "^3.23.0" + "@braintree/sanitize-url" "^6.0.1" + "@types/d3-scale" "^4.0.3" + "@types/d3-scale-chromatic" "^3.0.0" + cytoscape "^3.28.1" cytoscape-cose-bilkent "^4.1.0" - cytoscape-fcose "^2.1.0" - d3 "^7.0.0" - dagre-d3-es "7.0.8" - dompurify "2.4.3" - elkjs "^0.8.2" + d3 "^7.4.0" + d3-sankey "^0.12.3" + dagre-d3-es "7.0.10" + dayjs "^1.11.7" + dompurify "^3.0.5" + elkjs "^0.9.0" + katex "^0.16.9" khroma "^2.0.0" lodash-es "^4.17.21" - moment "^2.29.4" + mdast-util-from-markdown "^1.3.0" non-layered-tidy-tree-layout "^2.0.2" - stylis "^4.1.2" + stylis "^4.1.3" ts-dedent "^2.2.0" uuid "^9.0.0" + web-worker "^1.2.0" micromark-core-commonmark@^1.0.0, micromark-core-commonmark@^1.0.1: version "1.0.6" @@ -5866,11 +5976,6 @@ mkdirp-classic@^0.5.2: resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== -moment@^2.29.4: - version "2.29.4" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - mri@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" @@ -5886,6 +5991,11 @@ ms@^2.1.1: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +nanoid@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-4.0.2.tgz#140b3c5003959adbebf521c170f282c5e7f9fb9e" + integrity sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw== + nanoid@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" @@ -7185,11 +7295,16 @@ styled-jsx@5.1.1: dependencies: client-only "0.0.1" -stylis@4.1.3, stylis@^4.1.2: +stylis@4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.3.tgz#fd2fbe79f5fed17c55269e16ed8da14c84d069f7" integrity sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA== +stylis@^4.1.3: + version "4.3.1" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.1.tgz#ed8a9ebf9f76fe1e12d462f5cc3c4c980b23a7eb" + integrity sha512-EQepAV+wMsIaGVGX1RECzgrcqRRU/0sYOHkeLsZ3fzHaHXZy4DaOOX0vOlGQdlsjkh3mFHAIlVimpwAs4dslyQ== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -7228,6 +7343,14 @@ svgo@^3.0.2: csso "^5.0.5" picocolors "^1.0.0" +swr@^2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/swr/-/swr-2.2.5.tgz#063eea0e9939f947227d5ca760cc53696f46446b" + integrity sha512-QtxqyclFeAsxEUeZIYmsaQ0UjimSq1RZ9Un7I68/0ClKK/U3LoyQunwkQfJZr2fc22DfIXLNDc2wFyTEikCUpg== + dependencies: + client-only "^0.0.1" + use-sync-external-store "^1.2.0" + symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -7626,6 +7749,11 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" +use-sync-external-store@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + util-deprecate@^1.0.1, util-deprecate@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -7732,6 +7860,11 @@ web-namespaces@^2.0.0: resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-2.0.1.tgz#1010ff7c650eccb2592cebeeaf9a1b253fd40692" integrity sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ== +web-worker@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.3.0.tgz#e5f2df5c7fe356755a5fb8f8410d4312627e6776" + integrity sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"