@bytechain.cn/colamd 1.5.0 → 1.5.1

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.
Files changed (196) hide show
  1. package/.trae/specs/optimize-theme-loading/checklist.md +20 -0
  2. package/.trae/specs/optimize-theme-loading/spec.md +103 -0
  3. package/.trae/specs/optimize-theme-loading/tasks.md +40 -0
  4. package/CHANGELOG.md +320 -0
  5. package/CLAUDE.md +56 -0
  6. package/README.md +498 -26
  7. package/README_CN.md +554 -27
  8. package/android/app/build/.npmkeep +0 -0
  9. package/android/app/build.gradle +76 -0
  10. package/android/app/capacitor.build.gradle +24 -0
  11. package/android/app/proguard-rules.pro +21 -0
  12. package/android/app/release.keystore +0 -0
  13. package/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
  14. package/android/app/src/main/AndroidManifest.xml +64 -0
  15. package/android/app/src/main/java/cn/bytechain/colamd/MainActivity.java +180 -0
  16. package/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
  17. package/android/app/src/main/res/drawable/splash.png +0 -0
  18. package/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  19. package/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  20. package/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  21. package/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  22. package/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  23. package/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  24. package/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  25. package/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  26. package/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  27. package/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  28. package/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  29. package/android/app/src/main/res/layout/activity_main.xml +12 -0
  30. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  31. package/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  32. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  33. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  34. package/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  35. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  36. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  37. package/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  38. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  39. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  40. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  41. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  42. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  43. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  44. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  45. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  46. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  47. package/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
  48. package/android/app/src/main/res/values/strings.xml +7 -0
  49. package/android/app/src/main/res/values/styles.xml +22 -0
  50. package/android/app/src/main/res/xml/file_paths.xml +5 -0
  51. package/android/app/src/main/res/xml/network_security_config.xml +8 -0
  52. package/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
  53. package/android/build.gradle +29 -0
  54. package/android/capacitor.settings.gradle +21 -0
  55. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  56. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  57. package/android/gradle.properties +22 -0
  58. package/android/gradlew +248 -0
  59. package/android/gradlew.bat +92 -0
  60. package/android/settings.gradle +5 -0
  61. package/android/variables.gradle +16 -0
  62. package/capacitor.config.js +29 -0
  63. package/capacitor.config.ts +30 -0
  64. package/demo.md +191 -484
  65. package/dist/main/index.js +91 -51
  66. package/dist/preload/index.js +1 -1
  67. package/dist/renderer/assets/{arc-tTbbM8LO.js → arc-_lugyDzx.js} +1 -1
  68. package/dist/renderer/assets/{architectureDiagram-3BPJPVTR-CEgYow6c.js → architectureDiagram-3BPJPVTR-DDfP-F9D.js} +4 -3
  69. package/dist/renderer/assets/{blockDiagram-GPEHLZMM-LHyVtPwW.js → blockDiagram-GPEHLZMM-DOETUKma.js} +5 -4
  70. package/dist/renderer/assets/{c4Diagram-AAUBKEIU-C1P1eJrf.js → c4Diagram-AAUBKEIU-kAmLfVtk.js} +3 -2
  71. package/dist/renderer/assets/{channel-upve91Tq.js → channel-CD4vJFwr.js} +1 -1
  72. package/dist/renderer/assets/{chunk-2J33WTMH-lag2vhq9.js → chunk-2J33WTMH-DkVrgw4l.js} +1 -1
  73. package/dist/renderer/assets/{chunk-4BX2VUAB-BXJ8Ggh-.js → chunk-4BX2VUAB-JTZ-VKNX.js} +1 -1
  74. package/dist/renderer/assets/{chunk-55IACEB6-CiBpxRa1.js → chunk-55IACEB6-Di_O5box.js} +1 -1
  75. package/dist/renderer/assets/{chunk-727SXJPM-ODeKQFXC.js → chunk-727SXJPM-BgKvwR8w.js} +5 -5
  76. package/dist/renderer/assets/{chunk-AQP2D5EJ-BK7xJolB.js → chunk-AQP2D5EJ-DonSXCCQ.js} +3 -3
  77. package/dist/renderer/assets/{chunk-FMBD7UC4-BxpCZPtz.js → chunk-FMBD7UC4-CsV8Lmy6.js} +1 -1
  78. package/dist/renderer/assets/{chunk-ND2GUHAM-CqqaU9Ue.js → chunk-ND2GUHAM-C_-_dlq7.js} +1 -1
  79. package/dist/renderer/assets/{chunk-QZHKN3VN-Biq_K124.js → chunk-QZHKN3VN-aCmcDsfu.js} +1 -1
  80. package/dist/renderer/assets/{classDiagram-v2-Q7XG4LA2-Cq95X99o.js → classDiagram-4FO5ZUOK-nuHQLjzM.js} +7 -6
  81. package/dist/renderer/assets/{classDiagram-4FO5ZUOK-Cq95X99o.js → classDiagram-v2-Q7XG4LA2-nuHQLjzM.js} +7 -6
  82. package/dist/renderer/assets/{cose-bilkent-S5V4N54A-XasiD0bu.js → cose-bilkent-S5V4N54A-Di1_SXt9.js} +2 -1
  83. package/dist/renderer/assets/{dagre-BM42HDAG-Nq84Gfx4.js → dagre-BM42HDAG-CqOUIYsL.js} +4 -3
  84. package/dist/renderer/assets/{diagram-2AECGRRQ-DwuB1GWt.js → diagram-2AECGRRQ-F-fP19TC.js} +4 -3
  85. package/dist/renderer/assets/{diagram-5GNKFQAL-C2tgeI1h.js → diagram-5GNKFQAL-BD5XZc8G.js} +5 -4
  86. package/dist/renderer/assets/{diagram-KO2AKTUF-D5KzjNBc.js → diagram-KO2AKTUF-Qa3ZxA67.js} +4 -3
  87. package/dist/renderer/assets/{diagram-LMA3HP47-C12xHS1c.js → diagram-LMA3HP47-DqDnw2RA.js} +4 -3
  88. package/dist/renderer/assets/{diagram-OG6HWLK6-CnxI9oEa.js → diagram-OG6HWLK6-BH4Elzby.js} +5 -4
  89. package/dist/renderer/assets/{erDiagram-TEJ5UH35-D_uPaKwn.js → erDiagram-TEJ5UH35-CaKZCewa.js} +5 -4
  90. package/dist/renderer/assets/{flowDiagram-I6XJVG4X-B6q_1-tE.js → flowDiagram-I6XJVG4X-C8znUgyL.js} +7 -6
  91. package/dist/renderer/assets/{ganttDiagram-6RSMTGT7-CFo7ifF9.js → ganttDiagram-6RSMTGT7-DnRvbMnU.js} +3 -2
  92. package/dist/renderer/assets/{gitGraphDiagram-PVQCEYII-WSexHTnq.js → gitGraphDiagram-PVQCEYII-CZuRZzk4.js} +5 -4
  93. package/dist/renderer/assets/{graph-DyX_9f6d.js → graph-CYiEKt0j.js} +1 -1
  94. package/dist/renderer/assets/index-B4uDgADr.js +530 -0
  95. package/dist/renderer/assets/{index-DW7LS8C1.js → index-BX6JHKv6.js} +1430 -408
  96. package/dist/renderer/assets/index-CBcVpA3d.js +30 -0
  97. package/dist/renderer/assets/index-CGj1spkU.js +27 -0
  98. package/dist/renderer/assets/{index-dyHEFYvY.css → index-CcwAgVRi.css} +442 -400
  99. package/dist/renderer/assets/index-D4CPFkph.js +9 -0
  100. package/dist/renderer/assets/index-DxOzbfR-.js +110 -0
  101. package/dist/renderer/assets/index-Y89U1ptl.js +9 -0
  102. package/dist/renderer/assets/{infoDiagram-5YYISTIA-DaeJdLRq.js → infoDiagram-5YYISTIA-BlBUdqMb.js} +3 -2
  103. package/dist/renderer/assets/{ishikawaDiagram-YF4QCWOH-DDCZc35f.js → ishikawaDiagram-YF4QCWOH-TeVytCrP.js} +2 -1
  104. package/dist/renderer/assets/{journeyDiagram-JHISSGLW-BEdmpAgl.js → journeyDiagram-JHISSGLW-BLZa3jnX.js} +5 -4
  105. package/dist/renderer/assets/{kanban-definition-UN3LZRKU-BEFtQcFb.js → kanban-definition-UN3LZRKU-foVxWrJn.js} +3 -2
  106. package/dist/renderer/assets/{layout-CAJgQHdw.js → layout-DOAlFUVb.js} +2 -2
  107. package/dist/renderer/assets/{linear-B2ggJ8Am.js → linear-BMBn6kVq.js} +1 -1
  108. package/dist/renderer/assets/{mindmap-definition-RKZ34NQL-DSxVgHB5.js → mindmap-definition-RKZ34NQL-5pGeNCcp.js} +4 -3
  109. package/dist/renderer/assets/{pieDiagram-4H26LBE5-CwYoJBuL.js → pieDiagram-4H26LBE5-N9aAUxfr.js} +5 -4
  110. package/dist/renderer/assets/preload-helper-tXtZnHb0.js +88 -0
  111. package/dist/renderer/assets/{quadrantDiagram-W4KKPZXB-CST9Fvg9.js → quadrantDiagram-W4KKPZXB-BPxbtjga.js} +3 -2
  112. package/dist/renderer/assets/{requirementDiagram-4Y6WPE33-DtrH52jS.js → requirementDiagram-4Y6WPE33-CK1LrJyG.js} +4 -3
  113. package/dist/renderer/assets/{sankeyDiagram-5OEKKPKP-ca1tPzJ_.js → sankeyDiagram-5OEKKPKP-BNj7Sqii.js} +2 -1
  114. package/dist/renderer/assets/{sequenceDiagram-3UESZ5HK-Dfp1EJZ7.js → sequenceDiagram-3UESZ5HK-B-r7lNhI.js} +4 -3
  115. package/dist/renderer/assets/{stateDiagram-AJRCARHV-Bha2QoNB.js → stateDiagram-AJRCARHV-wrWE0MRa.js} +7 -6
  116. package/dist/renderer/assets/{stateDiagram-v2-BHNVJYJU-DWgFUYu1.js → stateDiagram-v2-BHNVJYJU-CE-Lqo2d.js} +5 -4
  117. package/dist/renderer/assets/{timeline-definition-PNZ67QCA-C3h_-OTj.js → timeline-definition-PNZ67QCA-BkeMGH4J.js} +3 -2
  118. package/dist/renderer/assets/{vennDiagram-CIIHVFJN-DFzjSrZi.js → vennDiagram-CIIHVFJN-BTxVzto3.js} +2 -1
  119. package/dist/renderer/assets/{wardley-L42UT6IY-Cx-VbqoS.js → wardley-L42UT6IY-b-_GPpqL.js} +1 -1
  120. package/dist/renderer/assets/{wardleyDiagram-YWT4CUSO-S2D9XqX6.js → wardleyDiagram-YWT4CUSO-D2r5dVGW.js} +4 -3
  121. package/dist/renderer/assets/web-BKE0SH0E.js +36 -0
  122. package/dist/renderer/assets/web-CBsFp24u.js +564 -0
  123. package/dist/renderer/assets/web-Dc8YgoHP.js +24 -0
  124. package/dist/renderer/assets/web-TfDzToU7.js +58 -0
  125. package/dist/renderer/assets/{xychartDiagram-2RQKCTM6-Cfxigbts.js → xychartDiagram-2RQKCTM6-BHQdINVc.js} +3 -2
  126. package/dist/renderer/index.html +62 -3
  127. package/docs/RELEASE_NOTES_v1.5.1.md +382 -0
  128. package/docs/academic-demo.md +567 -0
  129. package/docs/demo.html +748 -0
  130. package/docs/demo.md +546 -0
  131. package/docs/demo.pdf +0 -0
  132. package/docs/theme-paradigm.md +797 -0
  133. package/electron-builder.yml +7 -0
  134. package/electron.vite.config.js +31 -0
  135. package/electron.vite.config.ts +1 -1
  136. package/ios/App/App/AppDelegate.swift +49 -0
  137. package/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  138. package/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  139. package/ios/App/App/Assets.xcassets/Contents.json +6 -0
  140. package/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  141. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  142. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  143. package/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  144. package/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  145. package/ios/App/App/Base.lproj/Main.storyboard +19 -0
  146. package/ios/App/App/Info.plist +49 -0
  147. package/ios/App/App.xcodeproj/project.pbxproj +408 -0
  148. package/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  149. package/ios/App/Podfile +28 -0
  150. package/package.json +23 -3
  151. package/resources/templates/slides/template-forest-ink.html +540 -0
  152. package/scripts/generate-icons.js +102 -0
  153. package/src/main/index.ts +106 -68
  154. package/src/preload/index.d.ts +51 -0
  155. package/src/preload/index.js +70 -0
  156. package/src/preload/index.ts +2 -2
  157. package/src/renderer/capacitor-api.ts +713 -0
  158. package/src/renderer/editor/editor.ts +102 -19
  159. package/src/renderer/editor/plugins/index.ts +42 -32
  160. package/src/renderer/editor/plugins/math-plugin.ts +9 -1
  161. package/src/renderer/editor/plugins/mermaid-plugin-custom.css +13 -398
  162. package/src/renderer/editor/plugins/mermaid-plugin.ts +72 -71
  163. package/src/renderer/editor/plugins/themes/base/dark.css +23 -0
  164. package/src/renderer/editor/plugins/themes/base/elegant.css +32 -0
  165. package/src/renderer/editor/plugins/themes/base/light.css +20 -0
  166. package/src/renderer/editor/plugins/themes/base/newsprint.css +27 -0
  167. package/src/renderer/editor/plugins/themes/components/mermaid/academic.css +43 -0
  168. package/src/renderer/editor/plugins/themes/components/mermaid/dark.css +20 -0
  169. package/src/renderer/editor/plugins/themes/components/mermaid/elegant.css +24 -0
  170. package/src/renderer/editor/plugins/themes/components/mermaid/light.css +21 -0
  171. package/src/renderer/editor/plugins/themes/components/mermaid/newsprint.css +26 -0
  172. package/src/renderer/editor/plugins/themes/components/mermaid/variables.css +592 -0
  173. package/src/renderer/editor/plugins/themes/foundation.css +143 -0
  174. package/src/renderer/editor/plugins/themes/theme-manager.ts +133 -0
  175. package/src/renderer/env.d.ts +4 -1
  176. package/src/renderer/index.html +59 -1
  177. package/src/renderer/main.ts +581 -109
  178. package/src/renderer/mobile.css +428 -0
  179. package/themes/README.md +20 -0
  180. package/themes/academic-paper-pt.css +1321 -0
  181. package/themes/academic-paper.css +1416 -0
  182. package/themes/elegant.css +14 -7
  183. package/themes/forest-ink.css +664 -0
  184. package/themes/pixso-design.css +1261 -0
  185. package/themes/swiss-design.css +596 -0
  186. package/themes/template.css +498 -0
  187. package/tsconfig.main.json +1 -0
  188. package/tsconfig.main.tsbuildinfo +1 -0
  189. package/tsconfig.preload.json +1 -0
  190. package/tsconfig.preload.tsbuildinfo +1 -0
  191. package/tsconfig.renderer.json +1 -0
  192. package/tsconfig.renderer.tsbuildinfo +1 -0
  193. package/tsconfig.tsbuildinfo +1 -0
  194. package/.trae/documents/fix-mermaid-colors-and-sankey.md +0 -50
  195. package/src/renderer/themes/theme-manager.ts +0 -40
  196. /package/src/renderer/{themes → editor/plugins/themes}/base.css +0 -0
@@ -0,0 +1,20 @@
1
+ # Checklist
2
+
3
+ - [x] themes 目录已从 `src/renderer/themes/` 迁移到 `src/renderer/editor/plugins/themes/`
4
+ - [x] main.ts 中 `./themes/theme-manager` import 路径已更新为 `./editor/plugins/themes/theme-manager`
5
+ - [x] main.ts 中 `./themes/base.css` import 路径已更新为 `./editor/plugins/themes/base.css`
6
+ - [x] `parseTemplateDirective()` 可正确解析 `/* @template: light */` 注释
7
+ - [x] `setCachedCustomTheme()` 在导入自定义主题时正确缓存 CSS 内容和模版引用
8
+ - [x] `customThemeCache` 维护已导入的自定义主题数据
9
+ - [x] `applyTheme('custom:name')` 从缓存恢复 CSS 并正确应用(含模版变量层叠)
10
+ - [x] 自定义 → 预制 → 自定义 切换后样式完全恢复,无残留污染
11
+ - [x] 应用重启后通过 `setCachedCustomTheme` + `applyTheme` 恢复已保存的自定义主题
12
+ - [x] mermaid-plugin-custom.css 已移除与 variables.css 重复的基础选择器(从432行精简至46行)
13
+ - [x] mermaid-plugin-custom.css 变量命名与 `--mermaid-node-stroke` 等 foundation.css 体系对齐
14
+ - [x] mermaid-plugin.ts 中 `getCustomMermaidThemeVariables()` 变量名对齐(8处)
15
+ - [x] mermaid-plugin.ts 中 `getCustomMermaidC4Config()` 变量名对齐(20处)
16
+ - [x] mermaid-plugin.ts 中 custom 的 dark mode 从 `--mermaid-dark-mode` CSS 变量读取
17
+ - [x] 导入引用模版的自定义主题,模版 class 与 theme-custom class 同时生效
18
+ - [x] 导入不引用模版的自定义主题,行为与当前一致(向后兼容)
19
+ - [x] 所有内建主题无需修改,功能不变
20
+ - [x] TypeScript 编译无本次修改引入的新错误
@@ -0,0 +1,103 @@
1
+ # 优化外部主题载入设定 Spec
2
+
3
+ ## Why
4
+ 当前外部导入主题存在两个问题:
5
+ 1. **复杂度高**:用户需要编写完整的 CSS 文件(包含大量选择器和变量定义),没有模版继承机制
6
+ 2. **Bug**:自定义主题 → 预制主题 → 自定义主题 的切换过程中,自定义 CSS 样式丢失,导致预制主题的样式残留污染
7
+
8
+ 项目已有完整的 CSS 变量抽象体系(`themes/foundation.css` + `themes/base/*.css` + `themes/components/mermaid/*.css`),外部主题应能通过引用基础模版 + 少量变量覆写的方式完成定义,大幅降低配置代码量。
9
+
10
+ ## What Changes
11
+ - 将 `src/renderer/themes/` 目录迁移到 `src/renderer/editor/plugins/themes/` 下
12
+ - `theme-manager.ts`:新增模版引用机制,支持解析 `/* @template: light */` 指令;新增自定义 CSS 持久化缓存,修复切回自定义主题时样式丢失的 Bug
13
+ - `mermaid-plugin-custom.css`:精简优化,利用 CSS 变量体系减少冗余选择器
14
+ - `mermaid-plugin.ts`:优化 custom 主题路径的变量读取逻辑,适配模版引用机制
15
+ - `main.ts`:更新 import 路径;修复 `applyThemeChange` 不传 customCSS 的 Bug
16
+
17
+ ## Impact
18
+ - Affected specs: 主题系统
19
+ - Affected code:
20
+ - `src/renderer/themes/` → `src/renderer/editor/plugins/themes/` (目录迁移)
21
+ - `src/renderer/themes/theme-manager.ts` → 新增模版引用 + CSS 缓存
22
+ - `src/renderer/editor/plugins/mermaid-plugin-custom.css` (精简)
23
+ - `src/renderer/editor/plugins/mermaid-plugin.ts` (优化 custom 主题路径)
24
+ - `src/renderer/main.ts` (import 路径 + Bug 修复)
25
+
26
+ ## ADDED Requirements
27
+
28
+ ### Requirement: 外部主题模版引用机制
29
+ The system SHALL 支持外部导入的 CSS 文件通过 `/* @template: <name> */` 注释声明所引用的基础模版。
30
+ 对于没有标注引用的以 light 模版作为引入基础。
31
+
32
+ 支持的模版名称:`light`、`dark`、`elegant`、`newsprint`。
33
+
34
+ 当外部主题声明了模版引用,系统应先加载模版的 CSS 变量(来自 `themes/base/<name>.css` 和 `themes/components/mermaid/<name>.css`),再将导入的 CSS 作为覆写层叠加。导入的 CSS 只需定义与模版有差异的变量。
35
+
36
+ 对现有已经定义的复杂定义的主题模版要做到向下兼容。
37
+
38
+ #### Scenario: 引用 light 模版
39
+ - **WHEN** 用户导入以下 CSS:
40
+ ```css
41
+ /* @template: light */
42
+ :root {
43
+ --color-link: #ff6600;
44
+ --color-accent: #ff6600;
45
+ --mermaid-node-stroke: #ff6600;
46
+ --mermaid-highlight: #ff6600;
47
+ }
48
+ ```
49
+ - **THEN** 系统先加载 `themes/base/light.css` 的变量,再叠加以上覆写
50
+ - **THEN** 主样式使用 light 模版的字体/颜色/间距,仅链接色和强调色被覆写
51
+ - **THEN** Mermaid 图表使用 light 模版的 mermaid 变量作为基础,节点边框色被覆写为 `#ff6600`
52
+
53
+ #### Scenario: 不声明模版引用
54
+ - **WHEN** 用户导入的 CSS 不包含 `/* @template: */` 注释
55
+ - **THEN** 行为与当前一致:仅注入自定义 CSS,其他变量使用 `:root` / `foundation.css` 默认值
56
+
57
+ ### Requirement: 自定义主题 CSS 持久化缓存
58
+ The system SHALL 在 `theme-manager.ts` 中缓存最后导入的自定义 CSS 内容和模版引用信息,确保任何时候切换回自定义主题都能正确恢复样式。
59
+
60
+ #### Scenario: 自定义 → 预制 → 自定义 切换
61
+ - **WHEN** 用户先导入自定义主题,再切换到 dark 主题,再切换回自定义主题
62
+ - **THEN** 自定义主题的 CSS 样式完全恢复,不残留 dark 主题的样式
63
+ - **THEN** Mermaid 图表以自定义主题配色正确渲染
64
+
65
+ #### Scenario: 应用重启后恢复
66
+ - **WHEN** 应用重启后加载保存的自定义主题(localStorage 中存有 `custom:<name>`)
67
+ - **THEN** 系统通过 API 重新加载该主题的 CSS 文件并恢复样式
68
+ - **THEN** 模版引用信息随主题一起持久化恢复
69
+
70
+ ### Requirement: themes 目录迁移到 editor/plugins 下
71
+ The system SHALL 将 `src/renderer/themes/` 目录整体迁移到 `src/renderer/editor/plugins/themes/`,所有相关 import 路径同步更新。
72
+
73
+ #### Scenario: main.ts 引用路径
74
+ - **WHEN** main.ts 导入 theme-manager 和 base.css
75
+ - **THEN** import 路径从 `./themes/theme-manager` 更新为 `./editor/plugins/themes/theme-manager`
76
+ - **THEN** CSS import 路径从 `./themes/base.css` 更新为 `./editor/plugins/themes/base.css`
77
+
78
+ ## MODIFIED Requirements
79
+
80
+ ### Requirement: mermaid-plugin-custom.css 精简
81
+ **Before**: 包含大量与 `themes/components/mermaid/variables.css` 功能重叠的选择器(节点样式、连线样式、标签样式等),使用旧的变量命名(`--mermaid-node-border` 而非 `--mermaid-node-stroke`)。
82
+ **After**:
83
+ - 移除与 `variables.css` 重复的通用选择器(节点/连线/标签/聚类等基础样式)
84
+ - 仅保留 `custom` 主题特有的差异化样式(如 `person-man` 强制白色文字、`foreignObject` span 颜色等)
85
+ - 变量命名与 `foundation.css` 中的 `--mermaid-*` 体系对齐
86
+
87
+ ### Requirement: mermaid-plugin.ts custom 主题变量读取优化
88
+ **Before**: `getCustomMermaidThemeVariables()` 和 `getCustomMermaidC4Config()` 使用旧的变量命名(`--mermaid-node-border`、`--mermaid-line-color` 等),fallback 链混乱。
89
+ **After**:
90
+ - 变量名与 `foundation.css` 的 `--mermaid-*` 命名体系对齐
91
+ - fallback 逻辑清晰,优先读 `--mermaid-*` 专用变量,fallback 到通用 CSS 变量
92
+ - `getMermaidTheme()` 中 custom 主题的 dark mode 判断从 `--mermaid-dark-mode` CSS 变量读取
93
+
94
+ ### Requirement: theme-manager.ts applyTheme 函数
95
+ **Before**: `applyTheme(name, customCSS?)` 仅注入传入的 `customCSS`,不维护缓存;切回自定义主题时无 CSS 可注入。
96
+ **After**:
97
+ - 内部缓存自定义 CSS 内容和模版引用
98
+ - `applyTheme` 在检测到 `custom:` 前缀时自动应用缓存(含模版变量层叠)
99
+ - 导出 `setCachedCustomTheme(name, css)` 供外部在导入时调用
100
+ - 导出 `getCachedCustomTheme(name)` 支持查询已缓存的主题
101
+
102
+ ## REMOVED Requirements
103
+ 无。所有现有功能保持不变,仅做增强和修复。
@@ -0,0 +1,40 @@
1
+ # Tasks
2
+
3
+ - [x] Task 1: 迁移 themes 目录到 editor/plugins 下
4
+ - [x] 将 `src/renderer/themes/` 完整移动到 `src/renderer/editor/plugins/themes/`
5
+ - [x] 更新 `src/renderer/main.ts` 中的 import 路径:`./themes/theme-manager` → `./editor/plugins/themes/theme-manager`
6
+ - [x] 更新 `src/renderer/main.ts` 中的 CSS import:`./themes/base.css` → `./editor/plugins/themes/base.css`
7
+
8
+ - [x] Task 2: 重构 theme-manager.ts — 模版引用 + CSS 缓存 + Bug 修复
9
+ - [x] 新增 `parseTemplateDirective(css: string): string | null` 函数,解析 `/* @template: <name> */`
10
+ - [x] 新增自定义 CSS 缓存(`customThemeCache: Map<string, { css: string; template: string | null }>`)
11
+ - [x] 导出 `setCachedCustomTheme(name, css)` 用于导入时缓存
12
+ - [x] 导出 `getCachedCustomTheme(name)` 用于查询已缓存的主题
13
+ - [x] 修改 `applyTheme(name, customCSS?)`:当 `name` 以 `custom:` 开头时从缓存恢复 CSS,并根据模版引用叠加模版 class
14
+
15
+ - [x] Task 3: 优化 mermaid-plugin-custom.css — 精简与 variables.css 去重
16
+ - [x] 移除与 `themes/components/mermaid/variables.css` 重复的基础选择器(节点/连线/标签/聚类等)
17
+ - [x] 保留 custom 主题特有的差异化样式(person-man 强制白色、文字偏移等)
18
+ - [x] 文件从 432 行精简至 46 行
19
+
20
+ - [x] Task 4: 优化 mermaid-plugin.ts — custom 主题变量读取对齐
21
+ - [x] 更新 `getCustomMermaidThemeVariables()` 中的变量名(8处对齐)
22
+ - [x] 更新 `getCustomMermaidC4Config()` 中的变量名(20处对齐)
23
+ - [x] `getMermaidTheme()` 中 custom 的 dark mode 判断已从 `--mermaid-dark-mode` CSS 变量读取(无需修改,已正确实现)
24
+
25
+ - [x] Task 5: 更新 main.ts — import 路径 + 调用来适配新 API
26
+ - [x] 导入 `setCachedCustomTheme` 函数
27
+ - [x] 修改 `onMenuImportTheme` 回调:先 `setCachedCustomTheme` 再 `applyTheme`
28
+ - [x] 修改移动端菜单 `import-theme` 回调,同上
29
+ - [x] 修改应用重启恢复逻辑:先 `setCachedCustomTheme` 再 `applyTheme`
30
+
31
+ - [x] Task 6: 验证
32
+ - [x] TypeScript renderer 编译无本次修改引入的新错误
33
+ - [x] 14 项 checklist 全部通过
34
+
35
+ # Task Dependencies
36
+ - Task 2 依赖 Task 1(迁移后路径才正确)
37
+ - Task 3 依赖 Task 1(CSS 文件引用 themes 目录)
38
+ - Task 4 可与 Task 3 并行
39
+ - Task 5 依赖 Task 1 和 Task 2
40
+ - Task 6 依赖 Task 1-5 全部完成
package/CHANGELOG.md ADDED
@@ -0,0 +1,320 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Changed
11
+
12
+ #### PDF Export & Plugin System
13
+ - **Refactored PDF export pipeline** ([`src/renderer/main.ts`](src/renderer/main.ts), [`src/main/index.ts`](src/main/index.ts)):
14
+ - Support for custom print styles with simplified base print CSS
15
+ - Refactored `buildExportHTML` function to auto-extract current theme styles
16
+ - Added auto-injection of custom theme print styles
17
+ - Streamlined export HTML template, removed hardcoded plugin styles in favor of plugin-injected styles
18
+
19
+ #### Plugin Style Management
20
+ - **Unified plugin style management** ([`src/renderer/editor/plugins/index.ts`](src/renderer/editor/plugins/index.ts), [`src/renderer/editor/plugins/math-plugin.ts`](src/renderer/editor/plugins/math-plugin.ts), [`src/renderer/editor/plugins/mermaid-plugin.ts`](src/renderer/editor/plugins/mermaid-plugin.ts)):
21
+ - Added unified configuration fields (clipboard styles, export styles) for Math and Mermaid plugins
22
+ - Replaced hardcoded style handling logic with dynamic retrieval from plugin configuration
23
+ - Optimized error recovery logic to dynamically skip failing plugins instead of hard-excluding math plugin
24
+
25
+ #### Theme System
26
+ - **Fixed custom theme export issues** ([`src/renderer/editor/plugins/themes/theme-manager.ts`](src/renderer/editor/plugins/themes/theme-manager.ts)):
27
+ - Fixed custom theme print CSS extraction logic to avoid Chromium CSSOM serialization issues
28
+ - **Rendering output optimization** ([`src/renderer/editor/editor.ts`](src/renderer/editor/editor.ts), [`src/renderer/main.ts`](src/renderer/main.ts)):
29
+ - Wrapped `getLiveHTML` return content in a div with id "write"
30
+ - Only render base element styles when not using custom themes
31
+
32
+ #### Mobile Platform
33
+ - **Fixed mobile media query** ([`src/renderer/mobile.css`](src/renderer/mobile.css)):
34
+ - Fixed missing screen type in media queries
35
+
36
+ ### Removed
37
+ - Removed outdated PDF font compensation document ([`docs/PDF_FONT_COMPENSATION.md`](docs/PDF_FONT_COMPENSATION.md))
38
+
39
+ ---
40
+
41
+ ## [1.5.1] - 2026-05-23
42
+
43
+ ### Added
44
+
45
+ #### Themes
46
+ - **Academic Paper theme** ([`themes/academic-paper.css`](themes/academic-paper.css)) — Academic paper theme strictly following GB/T 7713 national standard specifications, including three-line tables, SimHei/SimSun typography, multi-level headings, figure/table caption standards
47
+ - **Swiss Design theme** ([`themes/swiss-design.css`](themes/swiss-design.css)) 🇨🇭 — Swiss International Typographic Style: black-white-red color system, geometric sans-serif fonts, grid-based layout, white-on-black table headers
48
+ - **Pixso Design theme** ([`themes/pixso-design.css`](themes/pixso-design.css)) — Pixso design specification theme
49
+ - **Forest Ink theme** ([`themes/forest-ink.css`](themes/forest-ink.css)) — Forest ink style theme
50
+ - **Standardized template** ([`themes/template.css`](themes/template.css)) — Reference implementation template following v3.0 paradigm: variable-based + modular + print fidelity
51
+
52
+ #### Theme Development Framework
53
+ - **Theme paradigm document** ([`docs/theme-paradigm.md`](docs/theme-paradigm.md)) — Complete CSS theme development specification (v3.2):
54
+ - Design principles: variable-driven, modular, semantic naming, AI-agent derivable
55
+ - Design specifications: 30+ verifiable rules (MUST / MUST NOT / SHOULD) including WCAG contrast formula
56
+ - Print fidelity specifications: variable re-declaration, required element coverage list (12 categories), Chromium print constraints
57
+ - px unit unification standard (9.x): prohibits pt/rem mixing to ensure consistent PDF export font sizes
58
+
59
+ #### Platform Support
60
+ - **Android platform**: Capacitor 6 integration, native APK build, file picker, mobile-adapted styles ([`mobile.css`](src/renderer/mobile.css))
61
+ - **iOS platform**: Capacitor 6 integration, native IPA build
62
+ - **Dual-platform bridge**: Runtime auto-detection of Electron/Capacitor API (`capacitor-api.ts`)
63
+
64
+ #### Documentation & Demo
65
+ - **Academic paper demo document** ([`docs/academic-demo.md`](docs/academic-demo.md)) — Wanhua ecosystem research report with 8 Mermaid diagram groups
66
+ - **Inline SVG guide** ([`docs/demo.html`](docs/demo.html)) — Best practices demonstration for embedding SVG in Markdown
67
+ - **General demo document** ([`docs/demo.md`](docs/demo.md)) — Full feature showcase
68
+
69
+ ### Changed
70
+
71
+ #### Theme System Architecture
72
+ - **Modular refactoring**: Theme system split into `foundation.css` + `base/` built-in themes + `components/mermaid/` Mermaid variable mapping + user theme directory
73
+ - **Mermaid variable system**: 20 core CSS variables (`--mermaid-*`) auto-mapped to 22 chart type SVG selectors
74
+ - **Academic paper theme refactoring**: Section 14 hardcoded color values all refactored to `var()` variable references; all `pt` units replaced with `px` even integers
75
+
76
+ #### PDF Export & Plugin System (Post-release)
77
+ - **Refactored PDF export pipeline** ([`src/renderer/main.ts`](src/renderer/main.ts), [`src/main/index.ts`](src/main/index.ts)):
78
+ - Support for custom print styles with simplified base print CSS
79
+ - Refactored `buildExportHTML` function to auto-extract current theme styles and inject into export HTML
80
+ - Streamlined export HTML template, removed hardcoded plugin styles in favor of plugin-injected styles
81
+ - **Unified plugin style management** ([`src/renderer/editor/plugins/index.ts`](src/renderer/editor/plugins/index.ts), [`src/renderer/editor/plugins/math-plugin.ts`](src/renderer/editor/plugins/math-plugin.ts), [`src/renderer/editor/plugins/mermaid-plugin.ts`](src/renderer/editor/plugins/mermaid-plugin.ts)):
82
+ - Added unified configuration fields (clipboard styles, export styles) for Math and Mermaid plugins
83
+ - Replaced hardcoded style handling logic with dynamic retrieval from plugin configuration
84
+ - Optimized error recovery logic to dynamically skip failing plugins instead of hard-excluding math plugin
85
+
86
+ #### Editor Core & Rendering
87
+ - Removed debug auto-open developer tools code
88
+ - Optimized academic paper theme styles
89
+ - **Rendering output optimization** ([`src/renderer/editor/editor.ts`](src/renderer/editor/editor.ts), [`src/renderer/main.ts`](src/renderer/main.ts)):
90
+ - Wrapped `getLiveHTML` return content in a div with id "write"
91
+ - Only render base element styles when not using custom themes
92
+
93
+ ### Fixed
94
+
95
+ #### TypeScript Type System (beta.2)
96
+ - **Fixed 15 TypeScript type errors**:
97
+ - [`capacitor-api.ts`](src/renderer/capacitor-api.ts): Fixed `string | null` type assignment error
98
+ - [`editor.ts`](src/renderer/editor/editor.ts): Fixed `remarkPluginsCtx` type mismatch and `rootEl` null check
99
+ - [`math-plugin.ts`](src/renderer/editor/plugins/math-plugin.ts): Fixed `$NodeSchema` type compatibility with `$view` function
100
+ - [`mermaid-plugin.ts`](src/renderer/editor/plugins/mermaid-plugin.ts): Fixed Mermaid theme type and `$NodeSchema` type issues
101
+ - [`main.ts`](src/renderer/main.ts): Added Vite client types reference for `import.meta.glob`
102
+ - [`main/index.ts`](src/main/index.ts): Removed invalid `fs.createServer` import and `PrintToPDFOptions.marginType`
103
+ - **TypeScript project configuration update**: Added `"composite": true` to all project configurations for proper project references
104
+ - [`tsconfig.main.json`](tsconfig.main.json)
105
+ - [`tsconfig.preload.json`](tsconfig.preload.json)
106
+ - [`tsconfig.renderer.json`](tsconfig.renderer.json)
107
+
108
+ #### Mermaid Diagram Rendering
109
+ - **Fixed text offset and border issues** (elegant + academic-paper themes):
110
+ - Fixed Mermaid text offset problem
111
+ - Fixed variable name mismatch issue
112
+ - Fixed double border display issue
113
+ - **Mermaid theme system refactoring**:
114
+ - Adjusted to Guizang warm color palette (cream background + brown tones)
115
+ - Font size adjusted to 10.5pt for academic printing compatibility
116
+ - Added Typora compatible selectors (`.md-diagram-panel`)
117
+ - Added mobile responsive adaptation
118
+ - Unified text color and border styles
119
+
120
+ #### Theme Print Fidelity
121
+ - **Fixed missing print style mirrors**: Completed `@media print` screen attribute mirrors for template CSS and Swiss Design CSS
122
+ - Covered attributes include: font size, line height, font family, borders, spacing, letter spacing, etc.
123
+ - Ensured consistency between screen preview and PDF export
124
+ - **Fixed custom theme export issues** ([`theme-manager.ts`](src/renderer/editor/plugins/themes/theme-manager.ts)):
125
+ - Fixed custom theme print CSS extraction logic to avoid Chromium CSSOM serialization issues
126
+ - Added auto-injection of custom theme print styles
127
+
128
+ #### Android Platform (beta.1)
129
+ - **Chinese IME (Input Method Editor) fix**:
130
+ - Removed `e.preventDefault()` in `beforeinput` event to resolve CJK input method issues
131
+ - Enhanced ProseMirror editor IME composition event handling
132
+ - Used `-webkit-user-modify: read-write-plaintext-only` to improve input experience
133
+ - **Intent file open fix**:
134
+ - Added `Intent.ACTION_VIEW` handling in `MainActivity`
135
+ - Supported `onNewIntent` for opening new files when app is already running
136
+ - Passed file content to WebView via JavaScript events
137
+ - **PDF export fix**:
138
+ - Replaced Capacitor Plugin bridge with `JavascriptInterface`
139
+ - Added `ColaMDNativeBridge` class to call Android native `PrintManager`
140
+ - Added "Save as PDF" option
141
+ - Fixed pagination, save button, Mermaid version, and layer residue issues
142
+
143
+ #### Export Functionality Improvements
144
+ - **PDF/HTML export optimization**:
145
+ - Refactored Mermaid rendering logic with export sync wait mechanism
146
+ - Supported real-time rendered content export
147
+ - Fixed default filename logic
148
+ - **File manager open mechanism**:
149
+ - Adopted pull model: JS actively calls Java `checkPendingFile()` to query
150
+ - Eliminated JS event injection timing issues
151
+ - Added init detection + setInterval polling for dual guarantee
152
+
153
+ #### Mobile Adaptation
154
+ - **Fixed missing media query type** ([`mobile.css`](src/renderer/mobile.css)):
155
+ - Fixed missing screen type in media queries
156
+
157
+ #### Plugin System
158
+ - **Plugin import fixes and package version updates**
159
+ - **Decoupled plugin system**: Reduced main.ts dependency on specific plugins
160
+
161
+ ### Removed
162
+ - Removed outdated PDF font compensation document ([`docs/PDF_FONT_COMPENSATION.md`](docs/PDF_FONT_COMPENSATION.md))
163
+
164
+ ---
165
+
166
+ ## [1.5.1-beta.2] - 2026-05-22
167
+
168
+ ### Fixed
169
+
170
+ #### TypeScript Type Errors
171
+ - Fixed 15 TypeScript type errors across the codebase:
172
+ - `capacitor-api.ts`: Fixed `string | null` type assignment error
173
+ - `editor.ts`: Fixed `remarkPluginsCtx` type mismatch and `rootEl` null check
174
+ - `math-plugin.ts`: Fixed `$NodeSchema` type compatibility with `$view` function
175
+ - `mermaid-plugin.ts`: Fixed Mermaid theme type and `$NodeSchema` type issues
176
+ - `main.ts`: Added Vite client types reference for `import.meta.glob`
177
+ - `main/index.ts`: Removed invalid `createServer` import from `fs` and `marginType` from `PrintToPDFOptions`
178
+
179
+ #### TypeScript Project Configuration
180
+ - Added `"composite": true` to all TypeScript project configurations for proper project references:
181
+ - `tsconfig.main.json`
182
+ - `tsconfig.preload.json`
183
+ - `tsconfig.renderer.json`
184
+
185
+ ### Changed
186
+
187
+ #### Mermaid Theme System Refactor
188
+ - **Restructured Mermaid styles to warm color palette**:
189
+ - Changed Mermaid color scheme to Guizang warm tones (cream background + brown tones)
190
+ - Adjusted font size to 10.5pt for academic printing compatibility
191
+ - Added Typora compatible selectors (`.md-diagram-panel`)
192
+ - Added mobile responsive adaptation
193
+ - Unified text color and border styles
194
+
195
+ #### Theme System Architecture
196
+ - **New modular theme architecture**:
197
+ - `src/renderer/editor/plugins/themes/` — New theme manager and base styles
198
+ - `themes/base/` — Base theme CSS files (light, dark, elegant, newsprint)
199
+ - `themes/components/mermaid/` — Mermaid-specific theme CSS files
200
+ - `foundation.css` — Shared foundation styles
201
+ - `variables.css` — CSS variables for Mermaid theming
202
+
203
+ ### Added
204
+
205
+ #### New Themes
206
+ - **Academic Paper theme**: [`academic-paper.css`](themes/academic-paper.css)
207
+ - Mermaid color scheme in Guizang warm tones (cream background + brown tones)
208
+ - Font size optimized for academic printing (10.5pt)
209
+ - Typora compatible selectors (`.md-diagram-panel`)
210
+ - Mobile responsive adaptation
211
+ - **Pixso Design theme**: [`pixso-design.css`](themes/pixso-design.css)
212
+ - **Swiss Design theme**: [`swiss-design.css`](themes/swiss-design.css) 🇨🇭
213
+ - Pure black-white-red color system inspired by Swiss International Typographic Style
214
+ - Geometric sans-serif fonts (Helvetica / Inter), grid-based layout with generous whitespace
215
+ - Form follows function design philosophy, minimal and restrained aesthetic
216
+ - Complete Mermaid diagram integration with monochrome + accent red styling
217
+
218
+ #### Theme Development Framework
219
+ - **Theme paradigm document**: [`docs/theme-paradigm.md`](docs/theme-paradigm.md)
220
+ - Comprehensive CSS theme development specification (v3.0)
221
+ - Design principles: variable-based, modular, semantic naming, AI-agent derivable
222
+ - Mandatory design constraints with validation methods (MUST / MUST NOT / SHOULD levels)
223
+ - Color space specification: 5 seed colors + 3 font stacks auto-derivation system
224
+ - Print fidelity requirements: `@media print` as screen style mirror enhancement
225
+
226
+ - **Standardized theme template**: [`themes/template.css`](themes/template.css)
227
+ - Reference implementation following the v3.0 paradigm
228
+ - All required sections: design tokens, editor styles, code blocks, blockquotes, tables, Mermaid variables, print styles
229
+ - Ready-to-use template for creating new custom themes
230
+
231
+ #### Documentation Updates
232
+ - Updated [README.md](README.md) and [README_CN.md](README_CN.md) to include Swiss Design theme in the downloadable themes table
233
+ - Added comprehensive theme descriptions for all 7 external themes (elegant, guizang, forest-ink, academic-paper, pixso-design, swiss-design, template)
234
+
235
+ ---
236
+
237
+ ## [1.5.1-beta.1] - 2026-05-22
238
+
239
+ ### Added
240
+
241
+ #### Android Platform Support
242
+ - **Full Android platform support**: Integrated Capacitor 6 for native Android app builds
243
+ - **File picker functionality**: Integrated `@capawesome/capacitor-file-picker` plugin for file selection on Android devices
244
+ - **Mobile responsive styles**: Added [`mobile.css`](src/renderer/mobile.css) for optimized mobile display and interaction
245
+ - **Auto-generated app icons**: Added [`generate-icons.js`](scripts/generate-icons.js) script to auto-generate Android/iOS icons at various sizes
246
+ - Android mipmap icons (48px-192px)
247
+ - Android adaptive icon foreground layer (108px-432px)
248
+ - iOS AppIcon (1024x1024)
249
+
250
+ #### New Themes & Styles
251
+ - **Forest Ink slide theme**: Added forest ink color scheme slide template with full presentation logic and responsive layout
252
+ - **Academic Paper theme**: Added [`academic-paper.css`](src/renderer/styles/themes/academic-paper.css) theme
253
+ - Mermaid color scheme in Guizang warm tones (cream background + brown tones)
254
+ - Font size optimized for academic printing (10.5pt)
255
+ - Typora compatible selectors (`.md-diagram-panel`)
256
+ - Mobile responsive adaptation
257
+ - **Pixso Design theme**: Added [`pixso-design.css`](src/renderer/styles/themes/pixso-design.css) theme
258
+
259
+ ### Fixed
260
+
261
+ #### Android Platform Fixes
262
+ - **Chinese IME (Input Method Editor) fix**:
263
+ - Removed `e.preventDefault()` in `beforeinput` event to resolve CJK input method issues
264
+ - Enhanced ProseMirror editor IME composition event handling
265
+ - Used `-webkit-user-modify: read-write-plaintext-only` to improve input experience
266
+ - **Intent file open fix**:
267
+ - Added `Intent.ACTION_VIEW` handling in `MainActivity`
268
+ - Supported `onNewIntent` for opening new files when app is already running
269
+ - Passed file content to WebView via JavaScript events
270
+ - **PDF export fix**:
271
+ - Replaced Capacitor Plugin bridge with `JavascriptInterface`
272
+ - Added `ColaMDNativeBridge` class to call Android native `PrintManager`
273
+ - Added "Save as PDF" option
274
+ - Fixed pagination, save button, mermaid version, and layer residue issues
275
+
276
+ #### Export Functionality Improvements
277
+ - **PDF/HTML export**:
278
+ - Refactored Mermaid rendering logic with export sync wait mechanism
279
+ - Supported real-time rendered content export
280
+ - Fixed default filename logic
281
+ - **File manager open**:
282
+ - Adopted pull model: JS actively calls Java `checkPendingFile()` to query
283
+ - Eliminated JS event injection timing issues
284
+ - Added init detection + setInterval polling for dual guarantee
285
+
286
+ ### Changed
287
+
288
+ - **Mobile IME handling refactor**:
289
+ - Simplified mobile CSS styles, removed outdated Android IME patches
290
+ - Refactored Android file open event listener, using new `colamd-open-event` instead of old `intent-file-opened`
291
+ - **Close button style optimization**: Replaced rectangle rotation icon with standard cross line icon for more consistent visual effect
292
+ - **Theme style updates**:
293
+ - `mermaid-plugin.css`: Minor adjustments
294
+ - `forest-ink.css`: Updated forest ink theme
295
+
296
+ ### Documentation
297
+
298
+ - Added [`demo.md`](docs/demo.md) and [`demo.pdf`](docs/demo.pdf) demo documents
299
+ - Updated README and README_CN.md with export documentation and new doc paths
300
+ - Added mobile support documentation with tech stack, build/release workflow, and troubleshooting
301
+ - Added Forest Ink theme documentation
302
+
303
+ ### Dependencies
304
+
305
+ | Package | Version | Purpose |
306
+ |---------|---------|---------|
307
+ | @capawesome/capacitor-file-picker | ^6.2.0 | Android file picker plugin |
308
+ | sharp | ^0.34.5 | Icon generation tool |
309
+
310
+ ## [1.5.0] - 2026-05-18
311
+
312
+ ### Added
313
+
314
+ #### Renderer Plugin System (Core Feature)
315
+ - Introduce declarative plugin architecture with independent registration, enable/disable toggle, and dynamic module management
316
+ - Unified plugin design pattern: Schema Definition → NodeView Interaction → Remark Parsing → Markdown Serialization → PNG Export → Rendered/Source Dual Mode
317
+ - **Plug** menu in menu bar for unified plugin render control
318
+
319
+ #### Math Plugin (KaTeX Integration)
320
+ - Add KaTeX rendering engine for LaTeX math equation support
package/CLAUDE.md CHANGED
@@ -85,3 +85,59 @@ src/
85
85
  - 主题 CSS 与编辑器逻辑完全分离
86
86
  - 代码简洁,不过度设计
87
87
  - 每个新功能先问:这是必要的吗?
88
+
89
+ ### 插件系统规范
90
+
91
+ 插件与主程序通过 `RendererPlugin` 接口通信,遵循**弱耦合**原则:
92
+
93
+ **1. 插件注册**
94
+
95
+ 插件通过 `registerPluginModule()` 自注册(副作用导入):
96
+
97
+ ```typescript
98
+ // ✅ 正确:副作用导入,仅触发 registerPluginModule
99
+ import './editor/plugins/math-plugin'
100
+ import './editor/plugins/mermaid-plugin'
101
+
102
+ // ✅ 兜底:glob 加载可能遗漏的插件
103
+ const _pluginRegistry = import.meta.glob('./editor/plugins/*-plugin.ts', { eager: true })
104
+
105
+ // ❌ 禁止:导入插件专用函数/类型
106
+ import { awaitAllMermaidRenders } from './editor/plugins/mermaid-plugin'
107
+ ```
108
+
109
+ **2. 接口驱动**
110
+
111
+ `main.ts` 只通过 `RendererPlugin` 接口方法与插件交互,**禁止**直接导入插件专用函数或硬编码插件 ID:
112
+
113
+ ```typescript
114
+ // ✅ 正确:遍历插件,调用通用接口
115
+ for (const p of getAllPlugins()) p.ensureRendered?.()
116
+
117
+ // ❌ 禁止:直接导入插件专用函数
118
+ import { awaitAllMermaidRenders } from './editor/plugins/mermaid-plugin'
119
+ await awaitAllMermaidRenders()
120
+
121
+ // ❌ 禁止:硬编码插件 ID 做特殊处理
122
+ getAllPlugins().filter(p => p.id === 'mermaid')
123
+ ```
124
+
125
+ **3. 功能归属**
126
+
127
+ | 逻辑类型 | 归属 |
128
+ |----------|------|
129
+ | 插件注册、schema、视图、导出能力 | 插件文件 (`*-plugin.ts`) |
130
+ | 通用插件查询、切换、导出能力发现 | `plugins/index.ts` |
131
+ | 编辑器创建、markdown 读写 | `editor/editor.ts` |
132
+ | IPC 事件路由、UI 协调 | `main.ts` |
133
+
134
+ **4. 减少 main.ts 修改**
135
+
136
+ 新增插件功能时,优先在插件文件和 `plugins/index.ts` 中实现。`main.ts` 仅在需要新的 IPC 事件路由或 UI 协调时才修改。
137
+
138
+ **5. `RendererPlugin` 接口约定**
139
+
140
+ - `ensureRendered?: () => Promise<void>` — 导出前等待渲染完成
141
+ - `onThemeChange?: (theme: string) => void` — 主题切换时重新配置
142
+ - `exportCapabilities?: ExportCapability[]` — 右键导出菜单
143
+ - `nodeTypes?: string[]` — 声明插件管理的 ProseMirror 节点类型