@bytechain.cn/colamd 1.5.1-beta.2 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +194 -162
- package/README.md +148 -5
- package/README_CN.md +163 -13
- package/dist/lib/colamd-renderer.js +193804 -0
- package/dist/lib/colamd-renderer.js.map +1 -0
- package/dist/lib/colamd.css +1810 -0
- package/dist/lib/editor/editor.d.ts +27 -0
- package/dist/lib/editor/html-view.d.ts +2 -0
- package/dist/lib/editor/lib.d.ts +49 -0
- package/dist/lib/editor/plugins/index.d.ts +56 -0
- package/dist/lib/editor/plugins/lib-entry.d.ts +10 -0
- package/dist/lib/editor/plugins/math-plugin.d.ts +9 -0
- package/dist/lib/editor/plugins/mermaid-plugin.d.ts +19 -0
- package/dist/lib/editor/plugins/themes/theme-manager.d.ts +30 -0
- package/dist/main/index.js +107 -37
- package/dist/preload/index.js +3 -2
- package/dist/renderer/assets/{arc-CPdeInCG.js → arc-CpIo2PoE.js} +1 -1
- package/dist/renderer/assets/{architectureDiagram-3BPJPVTR-BAbnaR9G.js → architectureDiagram-3BPJPVTR-T-4Cq0Bz.js} +2 -2
- package/dist/renderer/assets/{blockDiagram-GPEHLZMM-CYSWjnJg.js → blockDiagram-GPEHLZMM-C-SuR6eu.js} +4 -4
- package/dist/renderer/assets/{c4Diagram-AAUBKEIU-Rb1tstnr.js → c4Diagram-AAUBKEIU-PJp81cGm.js} +2 -2
- package/dist/renderer/assets/{channel-DpG2A6fE.js → channel-CtIHaaRI.js} +1 -1
- package/dist/renderer/assets/{chunk-2J33WTMH-DFc0Jxy_.js → chunk-2J33WTMH-BrchfQL6.js} +1 -1
- package/dist/renderer/assets/{chunk-4BX2VUAB-BhRxDTNn.js → chunk-4BX2VUAB-BCc3Ev_H.js} +1 -1
- package/dist/renderer/assets/{chunk-55IACEB6-DEgMVBk8.js → chunk-55IACEB6-B2M27HQo.js} +1 -1
- package/dist/renderer/assets/{chunk-727SXJPM-bjBIfiz8.js → chunk-727SXJPM-DXDHGECs.js} +5 -5
- package/dist/renderer/assets/{chunk-AQP2D5EJ-DwQMzTzD.js → chunk-AQP2D5EJ-BNb1lOQY.js} +3 -3
- package/dist/renderer/assets/{chunk-FMBD7UC4-CkphwJzs.js → chunk-FMBD7UC4-CzgfEH2z.js} +1 -1
- package/dist/renderer/assets/{chunk-ND2GUHAM-oU09z4y4.js → chunk-ND2GUHAM-BUFT_yOe.js} +1 -1
- package/dist/renderer/assets/{chunk-QZHKN3VN-rCbVuPBn.js → chunk-QZHKN3VN-C-zV7oBi.js} +1 -1
- package/dist/renderer/assets/{classDiagram-v2-Q7XG4LA2-DGS2faoM.js → classDiagram-4FO5ZUOK-CAyhGSvf.js} +6 -6
- package/dist/renderer/assets/{classDiagram-4FO5ZUOK-DGS2faoM.js → classDiagram-v2-Q7XG4LA2-CAyhGSvf.js} +6 -6
- package/dist/renderer/assets/{cose-bilkent-S5V4N54A-iqY6-EwA.js → cose-bilkent-S5V4N54A-ldu81kCk.js} +1 -1
- package/dist/renderer/assets/{dagre-BM42HDAG-5t3X5sDa.js → dagre-BM42HDAG-NJgy8CTw.js} +3 -3
- package/dist/renderer/assets/{diagram-2AECGRRQ-DzHiYDPh.js → diagram-2AECGRRQ-CuIcMpOn.js} +2 -2
- package/dist/renderer/assets/{diagram-5GNKFQAL-BiNv6Keq.js → diagram-5GNKFQAL-BJwFCroB.js} +3 -3
- package/dist/renderer/assets/{diagram-KO2AKTUF-ClzeDG6f.js → diagram-KO2AKTUF-C7NgQ8ju.js} +2 -2
- package/dist/renderer/assets/{diagram-LMA3HP47-CGkw7wII.js → diagram-LMA3HP47-B71v6MOq.js} +2 -2
- package/dist/renderer/assets/{diagram-OG6HWLK6-Dl-Hyk1_.js → diagram-OG6HWLK6-D2ZxkrSe.js} +3 -3
- package/dist/renderer/assets/{erDiagram-TEJ5UH35-BxUN79Qb.js → erDiagram-TEJ5UH35-4ToW0p3h.js} +4 -4
- package/dist/renderer/assets/{flowDiagram-I6XJVG4X-CzFk-KNI.js → flowDiagram-I6XJVG4X-DBkZLqwn.js} +6 -6
- package/dist/renderer/assets/{ganttDiagram-6RSMTGT7-C2xl6Igx.js → ganttDiagram-6RSMTGT7-G3xD2VXj.js} +2 -2
- package/dist/renderer/assets/{gitGraphDiagram-PVQCEYII-_fn7XCa7.js → gitGraphDiagram-PVQCEYII-BcTNiFfg.js} +3 -3
- package/dist/renderer/assets/{graph-CDoHYrHm.js → graph--Vhl4p4D.js} +1 -1
- package/dist/renderer/assets/{index-DAlXyxzt.js → index-C63bU7CF.js} +693 -162
- package/dist/renderer/assets/{index-CeFpoCKV.css → index-D8nA981z.css} +17 -6
- package/dist/renderer/assets/{infoDiagram-5YYISTIA-DL6XIxLz.js → infoDiagram-5YYISTIA-DjKa7Yv-.js} +1 -1
- package/dist/renderer/assets/{ishikawaDiagram-YF4QCWOH-BUZLjRo-.js → ishikawaDiagram-YF4QCWOH-xIWzW1pL.js} +1 -1
- package/dist/renderer/assets/{journeyDiagram-JHISSGLW-C4rH_mQM.js → journeyDiagram-JHISSGLW-DxMBkVOF.js} +4 -4
- package/dist/renderer/assets/{kanban-definition-UN3LZRKU-DRbrBcWV.js → kanban-definition-UN3LZRKU-DqJeL6E1.js} +2 -2
- package/dist/renderer/assets/{layout-DZl4n4qu.js → layout-B3giiMoK.js} +2 -2
- package/dist/renderer/assets/{linear-B0Krxg21.js → linear-Cqh3vVIf.js} +1 -1
- package/dist/renderer/assets/{mindmap-definition-RKZ34NQL-DdmPsWrn.js → mindmap-definition-RKZ34NQL-DUay02ma.js} +3 -3
- package/dist/renderer/assets/{pieDiagram-4H26LBE5-BPZLqwG0.js → pieDiagram-4H26LBE5-CVcfLtky.js} +3 -3
- package/dist/renderer/assets/{quadrantDiagram-W4KKPZXB-Dr-oWRk9.js → quadrantDiagram-W4KKPZXB-wDHffPOs.js} +2 -2
- package/dist/renderer/assets/{requirementDiagram-4Y6WPE33-B6QZd0lo.js → requirementDiagram-4Y6WPE33-C4pgGDGv.js} +3 -3
- package/dist/renderer/assets/{sankeyDiagram-5OEKKPKP-Cyl9ojEt.js → sankeyDiagram-5OEKKPKP-Jsf0rRMo.js} +1 -1
- package/dist/renderer/assets/{sequenceDiagram-3UESZ5HK-D48Yr9T6.js → sequenceDiagram-3UESZ5HK-e6QS7gt8.js} +3 -3
- package/dist/renderer/assets/{stateDiagram-AJRCARHV-qyb8ETsa.js → stateDiagram-AJRCARHV-DgYKZzDq.js} +6 -6
- package/dist/renderer/assets/{stateDiagram-v2-BHNVJYJU-DmDOyyrJ.js → stateDiagram-v2-BHNVJYJU-CUdmd_50.js} +4 -4
- package/dist/renderer/assets/{timeline-definition-PNZ67QCA-C-KQxTi1.js → timeline-definition-PNZ67QCA-S12e1Mp_.js} +2 -2
- package/dist/renderer/assets/{vennDiagram-CIIHVFJN-BdaZlnH-.js → vennDiagram-CIIHVFJN-CNDBG6A2.js} +1 -1
- package/dist/renderer/assets/{wardleyDiagram-YWT4CUSO-B2hBE-EE.js → wardleyDiagram-YWT4CUSO-CLlGQcof.js} +2 -2
- package/dist/renderer/assets/{xychartDiagram-2RQKCTM6-CSvswDTY.js → xychartDiagram-2RQKCTM6-CUtsHUQd.js} +2 -2
- package/dist/renderer/index.html +6 -2
- package/package.json +25 -1
- package/themes/README.md +18 -1
- package/themes/academic-paper-pt.css +1321 -0
- package/themes/academic-paper.css +192 -97
- package/.github/workflows/release.yml +0 -66
- package/.trae/specs/optimize-theme-loading/checklist.md +0 -20
- package/.trae/specs/optimize-theme-loading/spec.md +0 -103
- package/.trae/specs/optimize-theme-loading/tasks.md +0 -40
- package/CLAUDE.md +0 -143
- package/android/app/build/.npmkeep +0 -0
- package/android/app/build.gradle +0 -76
- package/android/app/capacitor.build.gradle +0 -24
- package/android/app/proguard-rules.pro +0 -21
- package/android/app/release.keystore +0 -0
- package/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +0 -26
- package/android/app/src/main/AndroidManifest.xml +0 -64
- package/android/app/src/main/java/cn/bytechain/colamd/MainActivity.java +0 -180
- package/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -170
- package/android/app/src/main/res/drawable/splash.png +0 -0
- package/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
- package/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
- package/android/app/src/main/res/layout/activity_main.xml +0 -12
- package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
- package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/android/app/src/main/res/values/ic_launcher_background.xml +0 -4
- package/android/app/src/main/res/values/strings.xml +0 -7
- package/android/app/src/main/res/values/styles.xml +0 -22
- package/android/app/src/main/res/xml/file_paths.xml +0 -5
- package/android/app/src/main/res/xml/network_security_config.xml +0 -8
- package/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +0 -18
- package/android/build.gradle +0 -29
- package/android/capacitor.settings.gradle +0 -21
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/android/gradle.properties +0 -22
- package/android/gradlew +0 -248
- package/android/gradlew.bat +0 -92
- package/android/settings.gradle +0 -5
- package/android/variables.gradle +0 -16
- package/bytechain.cn-colamd-1.5.1-beta.2.tgz +0 -0
- package/capacitor.config.js +0 -29
- package/capacitor.config.ts +0 -30
- package/demo.md +0 -193
- package/docs/academic-demo.md +0 -566
- package/docs/agent-diff-view.md +0 -48
- package/docs/demo.html +0 -748
- package/docs/demo.md +0 -546
- package/docs/demo.pdf +0 -0
- package/docs/theme-paradigm.md +0 -658
- package/electron-builder.yml +0 -64
- package/electron.vite.config.js +0 -31
- package/electron.vite.config.ts +0 -30
- package/ios/App/App/AppDelegate.swift +0 -49
- package/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
- package/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -14
- package/ios/App/App/Assets.xcassets/Contents.json +0 -6
- package/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +0 -23
- package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/ios/App/App/Base.lproj/LaunchScreen.storyboard +0 -32
- package/ios/App/App/Base.lproj/Main.storyboard +0 -19
- package/ios/App/App/Info.plist +0 -49
- package/ios/App/App.xcodeproj/project.pbxproj +0 -408
- package/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/App/Podfile +0 -28
- package/resources/entitlements.mac.plist +0 -12
- package/resources/icon.icns +0 -0
- package/resources/icon.png +0 -0
- package/resources/icon.svg +0 -23
- package/resources/templates/slides/icon.png +0 -0
- package/resources/templates/slides/slides-template.md +0 -74
- package/resources/templates/slides/template-forest-ink.html +0 -540
- package/resources/templates/slides/template.html +0 -535
- package/scripts/afterPack.js +0 -13
- package/scripts/generate-icons.js +0 -102
- package/src/main/index.ts +0 -905
- package/src/preload/index.d.ts +0 -51
- package/src/preload/index.js +0 -70
- package/src/preload/index.ts +0 -110
- package/src/renderer/capacitor-api.ts +0 -713
- package/src/renderer/editor/editor.ts +0 -287
- package/src/renderer/editor/html-view.ts +0 -15
- package/src/renderer/editor/plugins/index.ts +0 -68
- package/src/renderer/editor/plugins/math-plugin.ts +0 -297
- package/src/renderer/editor/plugins/mermaid-plugin-custom.css +0 -46
- package/src/renderer/editor/plugins/mermaid-plugin-dark.css +0 -428
- package/src/renderer/editor/plugins/mermaid-plugin-elegant.css +0 -443
- package/src/renderer/editor/plugins/mermaid-plugin-newsprint.css +0 -208
- package/src/renderer/editor/plugins/mermaid-plugin.css +0 -111
- package/src/renderer/editor/plugins/mermaid-plugin.ts +0 -670
- package/src/renderer/editor/plugins/themes/base/dark.css +0 -23
- package/src/renderer/editor/plugins/themes/base/elegant.css +0 -32
- package/src/renderer/editor/plugins/themes/base/light.css +0 -20
- package/src/renderer/editor/plugins/themes/base/newsprint.css +0 -27
- package/src/renderer/editor/plugins/themes/base.css +0 -509
- package/src/renderer/editor/plugins/themes/components/mermaid/academic.css +0 -43
- package/src/renderer/editor/plugins/themes/components/mermaid/dark.css +0 -20
- package/src/renderer/editor/plugins/themes/components/mermaid/elegant.css +0 -24
- package/src/renderer/editor/plugins/themes/components/mermaid/light.css +0 -21
- package/src/renderer/editor/plugins/themes/components/mermaid/newsprint.css +0 -26
- package/src/renderer/editor/plugins/themes/components/mermaid/variables.css +0 -592
- package/src/renderer/editor/plugins/themes/foundation.css +0 -143
- package/src/renderer/editor/plugins/themes/theme-manager.ts +0 -92
- package/src/renderer/env.d.ts +0 -10
- package/src/renderer/index.html +0 -76
- package/src/renderer/main.ts +0 -678
- package/src/renderer/mobile.css +0 -429
- package/tsconfig.json +0 -14
- package/tsconfig.main.json +0 -12
- package/tsconfig.main.tsbuildinfo +0 -1
- package/tsconfig.preload.json +0 -12
- package/tsconfig.preload.tsbuildinfo +0 -1
- package/tsconfig.renderer.json +0 -13
- package/tsconfig.renderer.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Editor } from '@milkdown/kit/core';
|
|
2
|
+
import '@milkdown/kit/prose/view/style/prosemirror.css';
|
|
3
|
+
export interface CreateEditorOptions {
|
|
4
|
+
onChange?: (markdown: string) => void;
|
|
5
|
+
/** Callback for Ctrl/Cmd+click on links. If not provided, falls back to electronAPI/capacitorAPI. */
|
|
6
|
+
onExternalLink?: (href: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a Milkdown editor with all registered plugins.
|
|
10
|
+
* This is the pure editor creation logic, separated from host-app wiring.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createMilkdownEditor(root: HTMLElement, options?: CreateEditorOptions): Promise<Editor>;
|
|
13
|
+
/**
|
|
14
|
+
* Create editor using element ID. Backward-compatible entry point for the Electron app.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createEditor(rootId: string, onChange?: (markdown: string) => void): Promise<Editor>;
|
|
17
|
+
export declare function getMarkdown(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get HTML by cloning the live rendered DOM.
|
|
20
|
+
* Unlike {@link getHTML} which uses DOMSerializer (creating fresh nodes with
|
|
21
|
+
* "Rendering..." placeholders), this captures the actual rendered SVGs
|
|
22
|
+
* from mermaid, KaTeX math, etc. Used for PDF/HTML export.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getLiveHTML(): string;
|
|
25
|
+
export declare function getHTML(): string;
|
|
26
|
+
export declare function setMarkdown(content: string): void;
|
|
27
|
+
export declare function togglePluginMode(nodeTypes: string[], mode: 'rendered' | 'raw'): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColaMD Renderer Library Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Provides a standalone Milkdown editor for embedding in external applications
|
|
5
|
+
* (e.g., VSCode extension WebViews). No Electron/Capacitor dependencies.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { createColaMDEditor } from '@bytechain.cn/colamd/renderer'
|
|
9
|
+
* const handle = await createColaMDEditor({ rootId: 'editor', editable: false })
|
|
10
|
+
* handle.setMarkdown('# Hello')
|
|
11
|
+
* const html = handle.getLiveHTML()
|
|
12
|
+
*/
|
|
13
|
+
import { Editor } from '@milkdown/kit/core';
|
|
14
|
+
import type { RendererPlugin } from './plugins';
|
|
15
|
+
import './plugins/lib-entry';
|
|
16
|
+
import './plugins/themes/base.css';
|
|
17
|
+
export type { RendererPlugin };
|
|
18
|
+
export interface ColaMDEditorOptions {
|
|
19
|
+
/** DOM element ID to attach the editor to */
|
|
20
|
+
rootId: string;
|
|
21
|
+
/** Initial theme name (light/dark/elegant/newsprint) */
|
|
22
|
+
theme?: string;
|
|
23
|
+
/** Whether the editor is editable. Default: true */
|
|
24
|
+
editable?: boolean;
|
|
25
|
+
/** Callback when content changes */
|
|
26
|
+
onChange?: (markdown: string) => void;
|
|
27
|
+
/** Callback for Ctrl/Cmd+click on links */
|
|
28
|
+
onExternalLink?: (href: string) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface ColaMDEditorHandle {
|
|
31
|
+
editor: Editor;
|
|
32
|
+
setMarkdown(content: string): void;
|
|
33
|
+
getMarkdown(): string;
|
|
34
|
+
getHTML(): string;
|
|
35
|
+
getLiveHTML(): string;
|
|
36
|
+
/** 构建完整的独立 HTML 文档(含 CSS 变量、主题、插件样式),用于导出 */
|
|
37
|
+
buildExportHTML(): string;
|
|
38
|
+
applyTheme(name: string, customCSS?: string): void;
|
|
39
|
+
togglePlugin(id: string, enabled: boolean): void;
|
|
40
|
+
togglePluginMode(nodeTypes: string[], mode: 'rendered' | 'raw'): void;
|
|
41
|
+
ensureAllPluginsRendered(): Promise<void>;
|
|
42
|
+
getAllPlugins(): RendererPlugin[];
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a ColaMD editor instance for embedding in external applications.
|
|
47
|
+
* This is the main library API — no Electron/Capacitor dependencies.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createColaMDEditor(options: ColaMDEditorOptions): Promise<ColaMDEditorHandle>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { MilkdownPlugin } from '@milkdown/ctx';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
3
|
+
export interface ExportCapability {
|
|
4
|
+
label: string;
|
|
5
|
+
defaultName: string;
|
|
6
|
+
filter: {
|
|
7
|
+
name: string;
|
|
8
|
+
extensions: string[];
|
|
9
|
+
};
|
|
10
|
+
execute: (element: HTMLElement) => Promise<string | null>;
|
|
11
|
+
}
|
|
12
|
+
export interface RendererPlugin {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
remarkPlugin?: {
|
|
17
|
+
plugin: Plugin<any[], any>;
|
|
18
|
+
options?: any;
|
|
19
|
+
};
|
|
20
|
+
rehypePlugin?: Plugin<any[], any>;
|
|
21
|
+
onMount?: (...args: any[]) => any;
|
|
22
|
+
onBeforeMount?: (...args: any[]) => any;
|
|
23
|
+
onInit?: () => void;
|
|
24
|
+
onThemeChange?: (theme: string, customCSS?: string) => void;
|
|
25
|
+
css?: string;
|
|
26
|
+
nodeTypes?: string[];
|
|
27
|
+
exportCapabilities?: ExportCapability[];
|
|
28
|
+
renderStatus?: (container: HTMLElement) => Promise<{
|
|
29
|
+
ok: number;
|
|
30
|
+
fail: number;
|
|
31
|
+
total: number;
|
|
32
|
+
}>;
|
|
33
|
+
ensureRendered?: () => Promise<void>;
|
|
34
|
+
/** Selector→inline-style pairs applied during clipboard copy/cut */
|
|
35
|
+
clipboardStyles?: Record<string, string>;
|
|
36
|
+
/** CSS rules injected into HTML export (use var(--...) for theme colors) */
|
|
37
|
+
exportStyles?: string;
|
|
38
|
+
/** Selectors for raw-source textareas/inputs (blurred on save, removed on export) */
|
|
39
|
+
rawSelectors?: string[];
|
|
40
|
+
/** Selectors for loading/error placeholder elements (hidden during export) */
|
|
41
|
+
hideSelectors?: string[];
|
|
42
|
+
/** Selectors for elements needing computed background-color captured during clone */
|
|
43
|
+
bgCaptureSelectors?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface PluginModule {
|
|
46
|
+
info: RendererPlugin;
|
|
47
|
+
milkdownPlugins: MilkdownPlugin[];
|
|
48
|
+
}
|
|
49
|
+
export declare function registerPluginModule(m: PluginModule): void;
|
|
50
|
+
export declare function getAllPluginModules(): PluginModule[];
|
|
51
|
+
export declare function getAllPlugins(): RendererPlugin[];
|
|
52
|
+
export declare function findPluginBySelector(selector: string): RendererPlugin | undefined;
|
|
53
|
+
export declare function findExportCapabilities(className: string): ExportCapability[];
|
|
54
|
+
export declare function togglePlugin(id: string, enabled: boolean): void;
|
|
55
|
+
/** Build a CSS selector matching all export-capable plugin block elements */
|
|
56
|
+
export declare function getContextMenuSelector(): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library entry point for plugin registration.
|
|
3
|
+
* Explicitly imports all plugin modules to trigger their side-effect registration
|
|
4
|
+
* via registerPluginModule(). This replaces the import.meta.glob pattern in main.ts
|
|
5
|
+
* which only works in Vite's renderer build.
|
|
6
|
+
*/
|
|
7
|
+
import './math-plugin';
|
|
8
|
+
import './mermaid-plugin';
|
|
9
|
+
export { getAllPluginModules, getAllPlugins, togglePlugin, registerPluginModule } from './index';
|
|
10
|
+
export type { RendererPlugin, PluginModule, ExportCapability } from './index';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeViewConstructor } from '@milkdown/prose/view';
|
|
2
|
+
import type { RendererPlugin } from './index';
|
|
3
|
+
import 'katex/dist/katex.min.css';
|
|
4
|
+
declare const mathInlineSchema: import("@milkdown/utils").$NodeSchema<"math_inline">;
|
|
5
|
+
declare const mathInlineView: import("@milkdown/utils").$View<import("@milkdown/utils").$Node | import("@milkdown/utils").$Mark, NodeViewConstructor | import("prosemirror-view").MarkViewConstructor>;
|
|
6
|
+
declare const mathBlockSchema: import("@milkdown/utils").$NodeSchema<"math_block">;
|
|
7
|
+
declare const mathBlockView: import("@milkdown/utils").$View<import("@milkdown/utils").$Node | import("@milkdown/utils").$Mark, NodeViewConstructor | import("prosemirror-view").MarkViewConstructor>;
|
|
8
|
+
export declare const mathPlugin: RendererPlugin;
|
|
9
|
+
export { mathInlineSchema, mathBlockSchema, mathInlineView, mathBlockView };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NodeViewConstructor } from '@milkdown/prose/view';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
3
|
+
import type { RendererPlugin } from './index';
|
|
4
|
+
import './mermaid-plugin.css';
|
|
5
|
+
import './mermaid-plugin-dark.css';
|
|
6
|
+
import './mermaid-plugin-elegant.css';
|
|
7
|
+
import './mermaid-plugin-newsprint.css';
|
|
8
|
+
import './mermaid-plugin-custom.css';
|
|
9
|
+
/**
|
|
10
|
+
* Wait for all currently pending mermaid render() calls to settle.
|
|
11
|
+
* Called before PDF/HTML export to ensure all diagrams are rendered.
|
|
12
|
+
*/
|
|
13
|
+
export declare function awaitAllMermaidRenders(): Promise<void>;
|
|
14
|
+
declare const remarkMermaid: Plugin;
|
|
15
|
+
declare const mermaidBlockSchema: import("@milkdown/utils").$NodeSchema<"mermaid_block">;
|
|
16
|
+
declare const mermaidBlockInputRule: import("@milkdown/utils").$InputRule;
|
|
17
|
+
declare const mermaidBlockView: import("@milkdown/utils").$View<import("@milkdown/utils").$Node | import("@milkdown/utils").$Mark, NodeViewConstructor | import("prosemirror-view").MarkViewConstructor>;
|
|
18
|
+
export declare const mermaidPlugin: RendererPlugin;
|
|
19
|
+
export { mermaidBlockSchema, mermaidBlockInputRule, mermaidBlockView, remarkMermaid };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 缓存导入的自定义主题 CSS 和模版引用
|
|
3
|
+
* @param name 主题文件名(不含 custom: 前缀)
|
|
4
|
+
* @param css 自定义 CSS 内容
|
|
5
|
+
*/
|
|
6
|
+
export declare function setCachedCustomTheme(name: string, css: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* 获取已缓存的自定义主题信息
|
|
9
|
+
* @param name 主题文件名
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCachedCustomTheme(name: string): {
|
|
12
|
+
css: string;
|
|
13
|
+
template: string | null;
|
|
14
|
+
} | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* 应用主题:内建主题添加对应 class,自定义主题注入 CSS 并叠加模版
|
|
17
|
+
* @param name 主题名称(light/dark/elegant/newsprint 或 custom:<name>)
|
|
18
|
+
* @param customCSS 自定义 CSS 内容(可选,导入时传入;切换时从缓存恢复)
|
|
19
|
+
*/
|
|
20
|
+
export declare function applyTheme(name: string, customCSS?: string): void;
|
|
21
|
+
export declare function loadSavedTheme(): string;
|
|
22
|
+
/** 获取当前激活的自定义主题 CSS 内容;非自定义主题返回 null */
|
|
23
|
+
export declare function getActiveCustomThemeCSS(): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* 从缓存的原始 CSS 文本中提取 @media print 规则块。
|
|
26
|
+
* 使用字符串括号计数而非 CSSOM 序列化,避免 Chromium 对嵌套 at-rule
|
|
27
|
+
*(如 @page 内的 @bottom-center)的序列化丢失问题。
|
|
28
|
+
* @returns 完整的 @media print { ... } 规则文本,无自定义主题或无 print 块返回 null
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractPrintCSSFromSheet(): string | null;
|
package/dist/main/index.js
CHANGED
|
@@ -4,7 +4,70 @@ const path = require("path");
|
|
|
4
4
|
const promises = require("fs/promises");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const http = require("http");
|
|
7
|
+
const en = {
|
|
8
|
+
app: { name: "ColaMD", title: "ColaMD" },
|
|
9
|
+
menu: { file: "File", edit: "Edit", view: "View", theme: "Theme", help: "Help", plugins: "Plugins", about: "About" },
|
|
10
|
+
fileMenu: { new: "New", newSlides: "New Slides...", open: "Open...", save: "Save", saveAs: "Save As...", exportPDF: "Export PDF...", exportHTML: "Export HTML...", exportSlides: "Export Slides...", openAsSlides: "Open as Slides", close: "Close", quit: "Quit" },
|
|
11
|
+
editMenu: { undo: "Undo", redo: "Redo", cut: "Cut", copy: "Copy", paste: "Paste", selectAll: "Select All" },
|
|
12
|
+
viewMenu: { resetZoom: "Actual Size", zoomIn: "Zoom In", zoomOut: "Zoom Out", toggleFullscreen: "Toggle Fullscreen" },
|
|
13
|
+
themeMenu: { light: "Light", dark: "Dark", elegant: "Elegant", newsprint: "Newsprint", importTheme: "Import Theme..." },
|
|
14
|
+
helpMenu: { about: "About ColaMD" }
|
|
15
|
+
};
|
|
16
|
+
const zhCN = {
|
|
17
|
+
app: { name: "ColaMD", title: "ColaMD" },
|
|
18
|
+
menu: { file: "文件", edit: "编辑", view: "视图", theme: "主题", help: "帮助", plugins: "插件", about: "关于" },
|
|
19
|
+
fileMenu: { new: "新建", newSlides: "新建幻灯片...", open: "打开...", save: "保存", saveAs: "另存为...", exportPDF: "导出 PDF...", exportHTML: "导出 HTML...", exportSlides: "导出幻灯片...", openAsSlides: "打开为幻灯片", close: "关闭", quit: "退出" },
|
|
20
|
+
editMenu: { undo: "撤销", redo: "重做", cut: "剪切", copy: "复制", paste: "粘贴", selectAll: "全选" },
|
|
21
|
+
viewMenu: { resetZoom: "实际大小", zoomIn: "放大", zoomOut: "缩小", toggleFullscreen: "切换全屏" },
|
|
22
|
+
themeMenu: { light: "浅色", dark: "深色", elegant: "优雅", newsprint: "新闻纸", importTheme: "导入主题..." },
|
|
23
|
+
helpMenu: { about: "关于 ColaMD" }
|
|
24
|
+
};
|
|
25
|
+
const localeMap = { "en": en, "zh-CN": zhCN };
|
|
26
|
+
let currentLocale = "en";
|
|
27
|
+
let initialized = false;
|
|
28
|
+
function detectDefaultLocale() {
|
|
29
|
+
try {
|
|
30
|
+
const locale = electron.app.getLocale();
|
|
31
|
+
if (locale.toLowerCase().startsWith("zh")) return "zh-CN";
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.warn("[i18n] Failed to detect system locale:", e);
|
|
34
|
+
}
|
|
35
|
+
return "en";
|
|
36
|
+
}
|
|
37
|
+
function initI18n() {
|
|
38
|
+
if (initialized) return;
|
|
39
|
+
currentLocale = detectDefaultLocale();
|
|
40
|
+
initialized = true;
|
|
41
|
+
console.log(`[i18n] Initialized with locale: ${currentLocale}`);
|
|
42
|
+
}
|
|
43
|
+
function getCurrentLocale() {
|
|
44
|
+
return currentLocale;
|
|
45
|
+
}
|
|
46
|
+
function setLocale(locale) {
|
|
47
|
+
if (currentLocale === locale) return false;
|
|
48
|
+
currentLocale = locale;
|
|
49
|
+
console.log(`[i18n] Locale changed to: ${currentLocale}`);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function t(key) {
|
|
53
|
+
const keys = key.split(".");
|
|
54
|
+
let value = localeMap[currentLocale];
|
|
55
|
+
for (const k of keys) {
|
|
56
|
+
if (value == null || typeof value !== "object") return key;
|
|
57
|
+
value = value[k];
|
|
58
|
+
}
|
|
59
|
+
return typeof value === "string" ? value : key;
|
|
60
|
+
}
|
|
7
61
|
const themesDir = path.join(electron.app.getPath("home"), ".colamd", "themes");
|
|
62
|
+
const BASE_PRINT_CSS = [
|
|
63
|
+
"html, body { height:auto !important; overflow:visible !important; -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }",
|
|
64
|
+
"#titlebar, #slides-btn, #agent-dot { display:none !important; }",
|
|
65
|
+
"#editor { height:auto !important; overflow:visible !important; }",
|
|
66
|
+
"#editor .ProseMirror { min-height:auto !important; }",
|
|
67
|
+
".mermaid-error, .mermaid-loading { display:none !important; }",
|
|
68
|
+
"svg .error-icon, svg .error-text { display:none !important; }",
|
|
69
|
+
".math-inline-raw, .math-block-raw, textarea.mermaid-source { display:none !important; }"
|
|
70
|
+
].join("\n");
|
|
8
71
|
function ensureThemesDir() {
|
|
9
72
|
if (!fs.existsSync(themesDir)) {
|
|
10
73
|
promises.mkdir(themesDir, { recursive: true }).catch(() => {
|
|
@@ -316,7 +379,7 @@ electron.ipcMain.handle("save-export-file", async (event, dataUrl, defaultName)
|
|
|
316
379
|
return false;
|
|
317
380
|
}
|
|
318
381
|
});
|
|
319
|
-
electron.ipcMain.handle("export-pdf", async (event) => {
|
|
382
|
+
electron.ipcMain.handle("export-pdf", async (event, printCSS) => {
|
|
320
383
|
const win = getWinFromEvent(event);
|
|
321
384
|
if (!win) return false;
|
|
322
385
|
const defaultName = (suggestFileName(win) || "colamd-print") + ".pdf";
|
|
@@ -326,9 +389,8 @@ electron.ipcMain.handle("export-pdf", async (event) => {
|
|
|
326
389
|
});
|
|
327
390
|
if (result.canceled || !result.filePath) return false;
|
|
328
391
|
try {
|
|
329
|
-
const cssKey = await win.webContents.insertCSS(
|
|
330
|
-
|
|
331
|
-
);
|
|
392
|
+
const cssKey = await win.webContents.insertCSS(BASE_PRINT_CSS + "\n" + (printCSS || ""));
|
|
393
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
332
394
|
const pdfData = await Promise.race([
|
|
333
395
|
win.webContents.printToPDF({
|
|
334
396
|
printBackground: true,
|
|
@@ -339,7 +401,8 @@ electron.ipcMain.handle("export-pdf", async (event) => {
|
|
|
339
401
|
await win.webContents.removeInsertedCSS(cssKey);
|
|
340
402
|
await promises.writeFile(result.filePath, pdfData);
|
|
341
403
|
return true;
|
|
342
|
-
} catch {
|
|
404
|
+
} catch (e) {
|
|
405
|
+
console.error("[export-pdf] PDF export failed:", e);
|
|
343
406
|
return false;
|
|
344
407
|
}
|
|
345
408
|
});
|
|
@@ -574,6 +637,11 @@ electron.ipcMain.handle("sync-plugin-state", (_event, id, enabled) => {
|
|
|
574
637
|
if (item) item.checked = enabled;
|
|
575
638
|
void buildMenu();
|
|
576
639
|
});
|
|
640
|
+
electron.ipcMain.handle("set-locale", (_event, locale) => {
|
|
641
|
+
const changed = setLocale(locale);
|
|
642
|
+
if (changed) void buildMenu();
|
|
643
|
+
return getCurrentLocale();
|
|
644
|
+
});
|
|
577
645
|
let cachedThemeFiles = [];
|
|
578
646
|
let themeFilesValid = false;
|
|
579
647
|
function invalidateThemeCache() {
|
|
@@ -617,21 +685,21 @@ async function buildMenu() {
|
|
|
617
685
|
});
|
|
618
686
|
}
|
|
619
687
|
const themeSubmenu = [
|
|
620
|
-
{ label: "
|
|
621
|
-
{ label: "
|
|
622
|
-
{ label: "
|
|
623
|
-
{ label: "
|
|
688
|
+
{ label: t("themeMenu.light"), click: () => sendToFocused("set-theme", "light") },
|
|
689
|
+
{ label: t("themeMenu.dark"), click: () => sendToFocused("set-theme", "dark") },
|
|
690
|
+
{ label: t("themeMenu.elegant"), click: () => sendToFocused("set-theme", "elegant") },
|
|
691
|
+
{ label: t("themeMenu.newsprint"), click: () => sendToFocused("set-theme", "newsprint") }
|
|
624
692
|
];
|
|
625
693
|
if (customThemeItems.length > 0) {
|
|
626
694
|
themeSubmenu.push({ type: "separator" }, ...customThemeItems);
|
|
627
695
|
}
|
|
628
696
|
themeSubmenu.push({ type: "separator" }, {
|
|
629
|
-
label: "
|
|
697
|
+
label: t("themeMenu.importTheme"),
|
|
630
698
|
click: () => sendToFocused("menu-import-theme")
|
|
631
699
|
});
|
|
632
700
|
const template = [
|
|
633
701
|
...isMac ? [{
|
|
634
|
-
label: "
|
|
702
|
+
label: t("app.name"),
|
|
635
703
|
submenu: [
|
|
636
704
|
{ role: "about" },
|
|
637
705
|
{ type: "separator" },
|
|
@@ -643,49 +711,49 @@ async function buildMenu() {
|
|
|
643
711
|
]
|
|
644
712
|
}] : [],
|
|
645
713
|
{
|
|
646
|
-
label: "
|
|
714
|
+
label: t("menu.file"),
|
|
647
715
|
submenu: [
|
|
648
716
|
{
|
|
649
|
-
label: "
|
|
717
|
+
label: t("fileMenu.new"),
|
|
650
718
|
accelerator: "CmdOrCtrl+N",
|
|
651
719
|
click: () => createWindow()
|
|
652
720
|
},
|
|
653
721
|
{
|
|
654
|
-
label: "
|
|
722
|
+
label: t("fileMenu.newSlides"),
|
|
655
723
|
accelerator: "CmdOrCtrl+Shift+N",
|
|
656
724
|
click: () => sendToFocused("menu-new-slides")
|
|
657
725
|
},
|
|
658
726
|
{
|
|
659
|
-
label: "
|
|
727
|
+
label: t("fileMenu.open"),
|
|
660
728
|
accelerator: "CmdOrCtrl+O",
|
|
661
729
|
click: () => sendToFocused("menu-open")
|
|
662
730
|
},
|
|
663
731
|
{ type: "separator" },
|
|
664
732
|
{
|
|
665
|
-
label: "
|
|
733
|
+
label: t("fileMenu.save"),
|
|
666
734
|
accelerator: "CmdOrCtrl+S",
|
|
667
735
|
click: () => sendToFocused("menu-save")
|
|
668
736
|
},
|
|
669
737
|
{
|
|
670
|
-
label: "
|
|
738
|
+
label: t("fileMenu.saveAs"),
|
|
671
739
|
accelerator: "CmdOrCtrl+Shift+S",
|
|
672
740
|
click: () => sendToFocused("menu-save-as")
|
|
673
741
|
},
|
|
674
742
|
{ type: "separator" },
|
|
675
743
|
{
|
|
676
|
-
label: "
|
|
744
|
+
label: t("fileMenu.exportPDF"),
|
|
677
745
|
click: () => sendToFocused("menu-export-pdf")
|
|
678
746
|
},
|
|
679
747
|
{
|
|
680
|
-
label: "
|
|
748
|
+
label: t("fileMenu.exportHTML"),
|
|
681
749
|
click: () => sendToFocused("menu-export-html")
|
|
682
750
|
},
|
|
683
751
|
{
|
|
684
|
-
label: "
|
|
752
|
+
label: t("fileMenu.exportSlides"),
|
|
685
753
|
click: () => sendToFocused("menu-export-slides")
|
|
686
754
|
},
|
|
687
755
|
{
|
|
688
|
-
label: "
|
|
756
|
+
label: t("fileMenu.openAsSlides"),
|
|
689
757
|
accelerator: "CmdOrCtrl+Shift+P",
|
|
690
758
|
click: () => sendToFocused("menu-open-as-slides")
|
|
691
759
|
},
|
|
@@ -694,37 +762,38 @@ async function buildMenu() {
|
|
|
694
762
|
]
|
|
695
763
|
},
|
|
696
764
|
{
|
|
697
|
-
label: "
|
|
765
|
+
label: t("menu.edit"),
|
|
698
766
|
submenu: [
|
|
699
|
-
{ role: "undo" },
|
|
700
|
-
{ role: "redo" },
|
|
767
|
+
{ label: t("editMenu.undo"), role: "undo" },
|
|
768
|
+
{ label: t("editMenu.redo"), role: "redo" },
|
|
769
|
+
{ type: "separator" },
|
|
770
|
+
{ label: t("editMenu.cut"), role: "cut" },
|
|
771
|
+
{ label: t("editMenu.copy"), role: "copy" },
|
|
772
|
+
{ label: t("editMenu.paste"), role: "paste" },
|
|
701
773
|
{ type: "separator" },
|
|
702
|
-
{ role: "
|
|
703
|
-
{ role: "copy" },
|
|
704
|
-
{ role: "paste" },
|
|
705
|
-
{ role: "selectAll" }
|
|
774
|
+
{ label: t("editMenu.selectAll"), role: "selectAll" }
|
|
706
775
|
]
|
|
707
776
|
},
|
|
708
777
|
{
|
|
709
|
-
label: "
|
|
778
|
+
label: t("menu.view"),
|
|
710
779
|
submenu: [
|
|
711
|
-
{ role: "resetZoom" },
|
|
712
|
-
{ role: "zoomIn" },
|
|
713
|
-
{ role: "zoomOut" },
|
|
780
|
+
{ label: t("viewMenu.resetZoom"), role: "resetZoom", accelerator: "CmdOrCtrl+0" },
|
|
781
|
+
{ label: t("viewMenu.zoomIn"), role: "zoomIn", accelerator: "CmdOrCtrl+Plus" },
|
|
782
|
+
{ label: t("viewMenu.zoomOut"), role: "zoomOut", accelerator: "CmdOrCtrl+-" },
|
|
714
783
|
{ type: "separator" },
|
|
715
|
-
{ role: "togglefullscreen" },
|
|
716
|
-
...pluginMenuItems.length > 0 ? [{ type: "separator" }, { label: "
|
|
784
|
+
{ label: t("viewMenu.toggleFullscreen"), role: "togglefullscreen" },
|
|
785
|
+
...pluginMenuItems.length > 0 ? [{ type: "separator" }, { label: t("menu.plugins"), submenu: pluginMenuItems }] : []
|
|
717
786
|
]
|
|
718
787
|
},
|
|
719
788
|
{
|
|
720
|
-
label: "
|
|
789
|
+
label: t("menu.theme"),
|
|
721
790
|
submenu: themeSubmenu
|
|
722
791
|
},
|
|
723
792
|
{
|
|
724
|
-
label: "
|
|
793
|
+
label: t("menu.help"),
|
|
725
794
|
submenu: [
|
|
726
795
|
{
|
|
727
|
-
label: "
|
|
796
|
+
label: t("helpMenu.about"),
|
|
728
797
|
click: () => electron.shell.openExternal("https://github.com/marswaveai/colamd")
|
|
729
798
|
}
|
|
730
799
|
]
|
|
@@ -733,6 +802,7 @@ async function buildMenu() {
|
|
|
733
802
|
electron.Menu.setApplicationMenu(electron.Menu.buildFromTemplate(template));
|
|
734
803
|
}
|
|
735
804
|
electron.app.whenReady().then(async () => {
|
|
805
|
+
initI18n();
|
|
736
806
|
ensureThemesDir();
|
|
737
807
|
await scanThemeFiles();
|
|
738
808
|
await buildMenu();
|
package/dist/preload/index.js
CHANGED
|
@@ -5,7 +5,7 @@ electron.contextBridge.exposeInMainWorld("electronAPI", {
|
|
|
5
5
|
openFilePath: (path) => electron.ipcRenderer.invoke("open-file-path", path),
|
|
6
6
|
saveFile: (content) => electron.ipcRenderer.invoke("save-file", content),
|
|
7
7
|
saveFileAs: (content) => electron.ipcRenderer.invoke("save-file-as", content),
|
|
8
|
-
exportPDF: () => electron.ipcRenderer.invoke("export-pdf"),
|
|
8
|
+
exportPDF: (printCSS) => electron.ipcRenderer.invoke("export-pdf", printCSS),
|
|
9
9
|
exportHTML: (html) => electron.ipcRenderer.invoke("export-html", html),
|
|
10
10
|
exportSlides: (content) => electron.ipcRenderer.invoke("export-slides", content),
|
|
11
11
|
newSlides: () => electron.ipcRenderer.invoke("new-slides"),
|
|
@@ -67,5 +67,6 @@ electron.contextBridge.exposeInMainWorld("electronAPI", {
|
|
|
67
67
|
onMenuTogglePlugin: (callback) => {
|
|
68
68
|
electron.ipcRenderer.on("menu-toggle-plugin", (_event, id) => callback(id));
|
|
69
69
|
},
|
|
70
|
-
exportFile: (dataUrl, defaultName) => electron.ipcRenderer.invoke("save-export-file", dataUrl, defaultName)
|
|
70
|
+
exportFile: (dataUrl, defaultName) => electron.ipcRenderer.invoke("save-export-file", dataUrl, defaultName),
|
|
71
|
+
setLocale: (locale) => electron.ipcRenderer.invoke("set-locale", locale)
|
|
71
72
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a0 as withPath, a1 as halfPi, a2 as epsilon, a3 as tau, a4 as cos, a5 as sin, a6 as min, a7 as abs, a8 as pi, a9 as sqrt, aa as atan2, ab as constant, ac as asin, ad as acos, ae as max } from "./index-
|
|
1
|
+
import { a0 as withPath, a1 as halfPi, a2 as epsilon, a3 as tau, a4 as cos, a5 as sin, a6 as min, a7 as abs, a8 as pi, a9 as sqrt, aa as atan2, ab as constant, ac as asin, ad as acos, ae as max } from "./index-C63bU7CF.js";
|
|
2
2
|
function arcInnerRadius(d) {
|
|
3
3
|
return d.innerRadius;
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b4 as getDefaultExportFromCjs, _ as __name, I as selectSvgElement, Y as setupGraphViewbox, l as log, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, z as clear, F as cleanAndMerge, D as getConfig, G as defaultConfig_default, c as getConfig2, aO as createText, b5 as getIconSVG, i as sanitizeText, d as select, x as getEdgeId, b6 as registerIconPacks, b7 as unknownIcon } from "./index-
|
|
2
|
-
import { p as populateCommonDb } from "./chunk-4BX2VUAB-
|
|
1
|
+
import { b4 as getDefaultExportFromCjs, _ as __name, I as selectSvgElement, Y as setupGraphViewbox, l as log, b as setAccTitle, a as getAccTitle, p as setDiagramTitle, q as getDiagramTitle, g as getAccDescription, s as setAccDescription, z as clear, F as cleanAndMerge, D as getConfig, G as defaultConfig_default, c as getConfig2, aO as createText, b5 as getIconSVG, i as sanitizeText, d as select, x as getEdgeId, b6 as registerIconPacks, b7 as unknownIcon } from "./index-C63bU7CF.js";
|
|
2
|
+
import { p as populateCommonDb } from "./chunk-4BX2VUAB-BCc3Ev_H.js";
|
|
3
3
|
import { p as parse } from "./wardley-L42UT6IY-b-_GPpqL.js";
|
|
4
4
|
import { c as cytoscape$1 } from "./cytoscape.esm-CpHeHM5e.js";
|
|
5
5
|
import "./preload-helper-tXtZnHb0.js";
|
package/dist/renderer/assets/{blockDiagram-GPEHLZMM-CYSWjnJg.js → blockDiagram-GPEHLZMM-C-SuR6eu.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getIconStyles } from "./chunk-FMBD7UC4-
|
|
2
|
-
import { an as isPrimitive, ao as getTag, ap as isTypedArray, aq as arrayBufferTag, ar as dataViewTag, as as booleanTag, at as numberTag, au as stringTag, av as dateTag, aw as regexpTag, ax as symbolTag, ay as mapTag, az as setTag, aA as argumentsTag, aB as uint32ArrayTag, aC as uint16ArrayTag, aD as uint8ClampedArrayTag, aE as uint8ArrayTag, aF as objectTag, aG as int32ArrayTag, aH as int16ArrayTag, aI as int8ArrayTag, aJ as float64ArrayTag, aK as float32ArrayTag, aL as arrayTag, _ as __name, D as getConfig, d as select, e as configureSvgSize, l as log, z as clear, B as rgba, aM as getLineFunctionsWithOffset, R as line, S as curveBasis, c as getConfig2, O as getUrl, aN as getEffectiveHtmlLabels, aO as createText, aP as computeLabelTransform, aQ as getSubGraphTitleMargins, u as utils_default, k as common_default, aR as getStylesFromArray, i as sanitizeText, aS as decodeEntities, aT as configureLabelImages } from "./index-
|
|
3
|
-
import { G as Graph } from "./graph
|
|
4
|
-
import { c as channel } from "./channel-
|
|
1
|
+
import { g as getIconStyles } from "./chunk-FMBD7UC4-CzgfEH2z.js";
|
|
2
|
+
import { an as isPrimitive, ao as getTag, ap as isTypedArray, aq as arrayBufferTag, ar as dataViewTag, as as booleanTag, at as numberTag, au as stringTag, av as dateTag, aw as regexpTag, ax as symbolTag, ay as mapTag, az as setTag, aA as argumentsTag, aB as uint32ArrayTag, aC as uint16ArrayTag, aD as uint8ClampedArrayTag, aE as uint8ArrayTag, aF as objectTag, aG as int32ArrayTag, aH as int16ArrayTag, aI as int8ArrayTag, aJ as float64ArrayTag, aK as float32ArrayTag, aL as arrayTag, _ as __name, D as getConfig, d as select, e as configureSvgSize, l as log, z as clear, B as rgba, aM as getLineFunctionsWithOffset, R as line, S as curveBasis, c as getConfig2, O as getUrl, aN as getEffectiveHtmlLabels, aO as createText, aP as computeLabelTransform, aQ as getSubGraphTitleMargins, u as utils_default, k as common_default, aR as getStylesFromArray, i as sanitizeText, aS as decodeEntities, aT as configureLabelImages } from "./index-C63bU7CF.js";
|
|
3
|
+
import { G as Graph } from "./graph--Vhl4p4D.js";
|
|
4
|
+
import { c as channel } from "./channel-CtIHaaRI.js";
|
|
5
5
|
import "./preload-helper-tXtZnHb0.js";
|
|
6
6
|
function isArray(value) {
|
|
7
7
|
return Array.isArray(value);
|
package/dist/renderer/assets/{c4Diagram-AAUBKEIU-Rb1tstnr.js → c4Diagram-AAUBKEIU-PJp81cGm.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getNoteRect, d as drawRect } from "./chunk-ND2GUHAM-
|
|
2
|
-
import { s as setAccDescription, g as getAccDescription, a as getAccTitle, b as setAccTitle, _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, f as assignWithDepth_default, h as calculateTextWidth, i as sanitizeText, j as distExports, w as wrapLabel, k as common_default, m as calculateTextHeight } from "./index-
|
|
1
|
+
import { g as getNoteRect, d as drawRect } from "./chunk-ND2GUHAM-BUFT_yOe.js";
|
|
2
|
+
import { s as setAccDescription, g as getAccDescription, a as getAccTitle, b as setAccTitle, _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, f as assignWithDepth_default, h as calculateTextWidth, i as sanitizeText, j as distExports, w as wrapLabel, k as common_default, m as calculateTextHeight } from "./index-C63bU7CF.js";
|
|
3
3
|
import "./preload-helper-tXtZnHb0.js";
|
|
4
4
|
var parser = (function() {
|
|
5
5
|
var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __name, e as configureSvgSize, l as log } from "./index-
|
|
1
|
+
import { _ as __name, e as configureSvgSize, l as log } from "./index-C63bU7CF.js";
|
|
2
2
|
var setupViewPortForSVG = /* @__PURE__ */ __name((svg, padding, cssDiagram, useMaxWidth) => {
|
|
3
3
|
svg.attr("class", cssDiagram);
|
|
4
4
|
const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { g as getIconStyles } from "./chunk-FMBD7UC4-
|
|
2
|
-
import { c as createTooltip } from "./chunk-ND2GUHAM-
|
|
3
|
-
import { g as getDiagramElement } from "./chunk-55IACEB6-
|
|
4
|
-
import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-
|
|
5
|
-
import { _ as __name, l as log, c as getConfig2, o as getRegisteredLayoutAlgorithm, r as render, u as utils_default, d as select, y as purify, b as setAccTitle, a as getAccTitle, s as setAccDescription, g as getAccDescription, p as setDiagramTitle, q as getDiagramTitle, k as common_default, z as clear, x as getEdgeId, i as sanitizeText, Q as parseGenericTypes } from "./index-
|
|
1
|
+
import { g as getIconStyles } from "./chunk-FMBD7UC4-CzgfEH2z.js";
|
|
2
|
+
import { c as createTooltip } from "./chunk-ND2GUHAM-BUFT_yOe.js";
|
|
3
|
+
import { g as getDiagramElement } from "./chunk-55IACEB6-B2M27HQo.js";
|
|
4
|
+
import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-BrchfQL6.js";
|
|
5
|
+
import { _ as __name, l as log, c as getConfig2, o as getRegisteredLayoutAlgorithm, r as render, u as utils_default, d as select, y as purify, b as setAccTitle, a as getAccTitle, s as setAccDescription, g as getAccDescription, p as setDiagramTitle, q as getDiagramTitle, k as common_default, z as clear, x as getEdgeId, i as sanitizeText, Q as parseGenericTypes } from "./index-C63bU7CF.js";
|
|
6
6
|
var parser = (function() {
|
|
7
7
|
var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
|
|
8
8
|
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getDiagramElement } from "./chunk-55IACEB6-
|
|
2
|
-
import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-
|
|
3
|
-
import { _ as __name, l as log, c as getConfig2, r as render, u as utils_default, a as getAccTitle, b as setAccTitle, g as getAccDescription, s as setAccDescription, p as setDiagramTitle, q as getDiagramTitle, T as generateId, k as common_default, z as clear } from "./index-
|
|
1
|
+
import { g as getDiagramElement } from "./chunk-55IACEB6-B2M27HQo.js";
|
|
2
|
+
import { s as setupViewPortForSVG } from "./chunk-2J33WTMH-BrchfQL6.js";
|
|
3
|
+
import { _ as __name, l as log, c as getConfig2, r as render, u as utils_default, a as getAccTitle, b as setAccTitle, g as getAccDescription, s as setAccDescription, p as setDiagramTitle, q as getDiagramTitle, T as generateId, k as common_default, z as clear } from "./index-C63bU7CF.js";
|
|
4
4
|
var parser = (function() {
|
|
5
5
|
var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
|
|
6
6
|
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __name, d as select, U as lineBreakRegex, j as distExports } from "./index-
|
|
1
|
+
import { _ as __name, d as select, U as lineBreakRegex, j as distExports } from "./index-C63bU7CF.js";
|
|
2
2
|
var drawRect = /* @__PURE__ */ __name((element, rectData) => {
|
|
3
3
|
const rectElement = element.append("rect");
|
|
4
4
|
rectElement.attr("x", rectData.x);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { s as styles_default, c as classRenderer_v3_unified_default, a as classDiagram_default, C as ClassDB } from "./chunk-727SXJPM-
|
|
2
|
-
import { _ as __name } from "./index-
|
|
3
|
-
import "./chunk-FMBD7UC4-
|
|
4
|
-
import "./chunk-ND2GUHAM-
|
|
5
|
-
import "./chunk-55IACEB6-
|
|
6
|
-
import "./chunk-2J33WTMH-
|
|
1
|
+
import { s as styles_default, c as classRenderer_v3_unified_default, a as classDiagram_default, C as ClassDB } from "./chunk-727SXJPM-DXDHGECs.js";
|
|
2
|
+
import { _ as __name } from "./index-C63bU7CF.js";
|
|
3
|
+
import "./chunk-FMBD7UC4-CzgfEH2z.js";
|
|
4
|
+
import "./chunk-ND2GUHAM-BUFT_yOe.js";
|
|
5
|
+
import "./chunk-55IACEB6-B2M27HQo.js";
|
|
6
|
+
import "./chunk-2J33WTMH-BrchfQL6.js";
|
|
7
7
|
import "./preload-helper-tXtZnHb0.js";
|
|
8
8
|
var diagram = {
|
|
9
9
|
parser: classDiagram_default,
|