feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as a monorepo subdirectory under desktop/. Source only — node_modules, dist, Cargo target and the upstream .git history are excluded. desktop/ keeps its own independent Cargo workspace (desktop/src-tauri with crates/*); it is not part of the backend boosapi crate, so a `cargo check` at the metapi root still compiles only the backend. Build the desktop app from desktop/src-tauri per desktop/README.md. Note: app icons are still placeholder assets pending the final BoosAPI logo. The updater signing keys live outside the repo and are not included.
This commit is contained in:
+76
@@ -0,0 +1,76 @@
|
||||
import katex from 'katex'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
class FakeKaTeXWorker {
|
||||
onmessage: ((event: MessageEvent) => void) | null = null
|
||||
onerror: ((event: ErrorEvent) => void) | null = null
|
||||
|
||||
postMessage(data: { id: string, content: string, displayMode: boolean }) {
|
||||
queueMicrotask(() => {
|
||||
try {
|
||||
const html = katex.renderToString(data.content, {
|
||||
throwOnError: true,
|
||||
displayMode: data.displayMode,
|
||||
output: 'html',
|
||||
strict: 'ignore',
|
||||
})
|
||||
this.onmessage?.({
|
||||
data: {
|
||||
id: data.id,
|
||||
html,
|
||||
content: data.content,
|
||||
displayMode: data.displayMode,
|
||||
},
|
||||
} as MessageEvent)
|
||||
}
|
||||
catch (error: any) {
|
||||
this.onmessage?.({
|
||||
data: {
|
||||
id: data.id,
|
||||
error: error?.message || String(error),
|
||||
content: data.content,
|
||||
displayMode: data.displayMode,
|
||||
},
|
||||
} as MessageEvent)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
terminate() {}
|
||||
}
|
||||
|
||||
let katexWorkerClient: typeof import('../packages/markstream-angular/src/workers/katexWorkerClient') | null = null
|
||||
|
||||
afterEach(() => {
|
||||
katexWorkerClient?.clearKaTeXWorker()
|
||||
katexWorkerClient = null
|
||||
vi.resetModules()
|
||||
})
|
||||
|
||||
describe('markstream-angular katex unicode unit render regression', () => {
|
||||
it('enhances inline and block math with unicode unit glyphs through the worker path', async () => {
|
||||
katexWorkerClient = await import('../packages/markstream-angular/src/workers/katexWorkerClient')
|
||||
katexWorkerClient.setKaTeXWorker(new FakeKaTeXWorker() as unknown as Worker)
|
||||
const { enhanceRenderedHtml } = await import('../packages/markstream-angular/src/enhanceRenderedHtml')
|
||||
|
||||
const root = document.createElement('div')
|
||||
root.innerHTML = `
|
||||
<div class="markstream-angular markdown-renderer">
|
||||
<span class="markstream-nested-math" data-display="inline">
|
||||
<span class="markstream-nested-math__source">c=0.75\\times10^3\\ \\text{J/(kg·℃)}</span>
|
||||
<span class="markstream-nested-math__render"></span>
|
||||
</span>
|
||||
<div class="markstream-nested-math-block">
|
||||
<pre class="markstream-nested-math-block__source"><code>Q_1=0.75\\times10^3\\ \\text{J/(kg·℃)}\\times1.1\\ \\text{kg}\\times40℃=3.3\\times 10^{4}\\ \\text{J}</code></pre>
|
||||
<div class="markstream-nested-math-block__render"></div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
const shell = root.querySelector('.markstream-angular') as HTMLElement
|
||||
await enhanceRenderedHtml(shell, { final: false })
|
||||
|
||||
expect(shell.querySelector('.markstream-nested-math__render .katex')).toBeTruthy()
|
||||
expect(shell.querySelector('.markstream-nested-math-block__render .katex-display')).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user