@md2nativedocx/core 0.1.0

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 (365) hide show
  1. package/README.md +15 -0
  2. package/dist/diagrams/architecture-diagram/parser.d.ts +29 -0
  3. package/dist/diagrams/architecture-diagram/parser.js +142 -0
  4. package/dist/diagrams/architecture-diagram/parser.js.map +1 -0
  5. package/dist/diagrams/architecture-diagram/translator.d.ts +41 -0
  6. package/dist/diagrams/architecture-diagram/translator.js +172 -0
  7. package/dist/diagrams/architecture-diagram/translator.js.map +1 -0
  8. package/dist/diagrams/architecture-diagram/types.d.ts +39 -0
  9. package/dist/diagrams/architecture-diagram/types.js +18 -0
  10. package/dist/diagrams/architecture-diagram/types.js.map +1 -0
  11. package/dist/diagrams/block/parser.d.ts +17 -0
  12. package/dist/diagrams/block/parser.js +312 -0
  13. package/dist/diagrams/block/parser.js.map +1 -0
  14. package/dist/diagrams/block/translator.d.ts +16 -0
  15. package/dist/diagrams/block/translator.js +137 -0
  16. package/dist/diagrams/block/translator.js.map +1 -0
  17. package/dist/diagrams/block/types.d.ts +38 -0
  18. package/dist/diagrams/block/types.js +6 -0
  19. package/dist/diagrams/block/types.js.map +1 -0
  20. package/dist/diagrams/c4/parser.d.ts +29 -0
  21. package/dist/diagrams/c4/parser.js +264 -0
  22. package/dist/diagrams/c4/parser.js.map +1 -0
  23. package/dist/diagrams/c4/translator.d.ts +50 -0
  24. package/dist/diagrams/c4/translator.js +240 -0
  25. package/dist/diagrams/c4/translator.js.map +1 -0
  26. package/dist/diagrams/c4/types.d.ts +74 -0
  27. package/dist/diagrams/c4/types.js +46 -0
  28. package/dist/diagrams/c4/types.js.map +1 -0
  29. package/dist/diagrams/class-diagram/parser.d.ts +40 -0
  30. package/dist/diagrams/class-diagram/parser.js +213 -0
  31. package/dist/diagrams/class-diagram/parser.js.map +1 -0
  32. package/dist/diagrams/class-diagram/translator.d.ts +48 -0
  33. package/dist/diagrams/class-diagram/translator.js +197 -0
  34. package/dist/diagrams/class-diagram/translator.js.map +1 -0
  35. package/dist/diagrams/class-diagram/types.d.ts +54 -0
  36. package/dist/diagrams/class-diagram/types.js +16 -0
  37. package/dist/diagrams/class-diagram/types.js.map +1 -0
  38. package/dist/diagrams/cynefin/parser.d.ts +24 -0
  39. package/dist/diagrams/cynefin/parser.js +102 -0
  40. package/dist/diagrams/cynefin/parser.js.map +1 -0
  41. package/dist/diagrams/cynefin/translator.d.ts +37 -0
  42. package/dist/diagrams/cynefin/translator.js +190 -0
  43. package/dist/diagrams/cynefin/translator.js.map +1 -0
  44. package/dist/diagrams/cynefin/types.d.ts +45 -0
  45. package/dist/diagrams/cynefin/types.js +36 -0
  46. package/dist/diagrams/cynefin/types.js.map +1 -0
  47. package/dist/diagrams/er-diagram/parser.d.ts +29 -0
  48. package/dist/diagrams/er-diagram/parser.js +156 -0
  49. package/dist/diagrams/er-diagram/parser.js.map +1 -0
  50. package/dist/diagrams/er-diagram/translator.d.ts +26 -0
  51. package/dist/diagrams/er-diagram/translator.js +151 -0
  52. package/dist/diagrams/er-diagram/translator.js.map +1 -0
  53. package/dist/diagrams/er-diagram/types.d.ts +44 -0
  54. package/dist/diagrams/er-diagram/types.js +17 -0
  55. package/dist/diagrams/er-diagram/types.js.map +1 -0
  56. package/dist/diagrams/event-modeling/parser.d.ts +16 -0
  57. package/dist/diagrams/event-modeling/parser.js +193 -0
  58. package/dist/diagrams/event-modeling/parser.js.map +1 -0
  59. package/dist/diagrams/event-modeling/translator.d.ts +17 -0
  60. package/dist/diagrams/event-modeling/translator.js +154 -0
  61. package/dist/diagrams/event-modeling/translator.js.map +1 -0
  62. package/dist/diagrams/event-modeling/types.d.ts +46 -0
  63. package/dist/diagrams/event-modeling/types.js +6 -0
  64. package/dist/diagrams/event-modeling/types.js.map +1 -0
  65. package/dist/diagrams/gantt/date-utils.d.ts +51 -0
  66. package/dist/diagrams/gantt/date-utils.js +131 -0
  67. package/dist/diagrams/gantt/date-utils.js.map +1 -0
  68. package/dist/diagrams/gantt/parser.d.ts +37 -0
  69. package/dist/diagrams/gantt/parser.js +221 -0
  70. package/dist/diagrams/gantt/parser.js.map +1 -0
  71. package/dist/diagrams/gantt/translator.d.ts +23 -0
  72. package/dist/diagrams/gantt/translator.js +259 -0
  73. package/dist/diagrams/gantt/translator.js.map +1 -0
  74. package/dist/diagrams/gantt/types.d.ts +31 -0
  75. package/dist/diagrams/gantt/types.js +14 -0
  76. package/dist/diagrams/gantt/types.js.map +1 -0
  77. package/dist/diagrams/git-graph/parser.d.ts +29 -0
  78. package/dist/diagrams/git-graph/parser.js +237 -0
  79. package/dist/diagrams/git-graph/parser.js.map +1 -0
  80. package/dist/diagrams/git-graph/translator.d.ts +49 -0
  81. package/dist/diagrams/git-graph/translator.js +224 -0
  82. package/dist/diagrams/git-graph/translator.js.map +1 -0
  83. package/dist/diagrams/git-graph/types.d.ts +72 -0
  84. package/dist/diagrams/git-graph/types.js +35 -0
  85. package/dist/diagrams/git-graph/types.js.map +1 -0
  86. package/dist/diagrams/ishikawa/parser.d.ts +15 -0
  87. package/dist/diagrams/ishikawa/parser.js +85 -0
  88. package/dist/diagrams/ishikawa/parser.js.map +1 -0
  89. package/dist/diagrams/ishikawa/translator.d.ts +12 -0
  90. package/dist/diagrams/ishikawa/translator.js +95 -0
  91. package/dist/diagrams/ishikawa/translator.js.map +1 -0
  92. package/dist/diagrams/ishikawa/types.d.ts +19 -0
  93. package/dist/diagrams/ishikawa/types.js +6 -0
  94. package/dist/diagrams/ishikawa/types.js.map +1 -0
  95. package/dist/diagrams/journey/parser.d.ts +14 -0
  96. package/dist/diagrams/journey/parser.js +78 -0
  97. package/dist/diagrams/journey/parser.js.map +1 -0
  98. package/dist/diagrams/journey/translator.d.ts +11 -0
  99. package/dist/diagrams/journey/translator.js +90 -0
  100. package/dist/diagrams/journey/translator.js.map +1 -0
  101. package/dist/diagrams/journey/types.d.ts +20 -0
  102. package/dist/diagrams/journey/types.js +6 -0
  103. package/dist/diagrams/journey/types.js.map +1 -0
  104. package/dist/diagrams/kanban/parser.d.ts +17 -0
  105. package/dist/diagrams/kanban/parser.js +129 -0
  106. package/dist/diagrams/kanban/parser.js.map +1 -0
  107. package/dist/diagrams/kanban/translator.d.ts +13 -0
  108. package/dist/diagrams/kanban/translator.js +72 -0
  109. package/dist/diagrams/kanban/translator.js.map +1 -0
  110. package/dist/diagrams/kanban/types.d.ts +21 -0
  111. package/dist/diagrams/kanban/types.js +6 -0
  112. package/dist/diagrams/kanban/types.js.map +1 -0
  113. package/dist/diagrams/mindmap/parser.d.ts +23 -0
  114. package/dist/diagrams/mindmap/parser.js +108 -0
  115. package/dist/diagrams/mindmap/parser.js.map +1 -0
  116. package/dist/diagrams/mindmap/translator.d.ts +31 -0
  117. package/dist/diagrams/mindmap/translator.js +249 -0
  118. package/dist/diagrams/mindmap/translator.js.map +1 -0
  119. package/dist/diagrams/mindmap/types.d.ts +19 -0
  120. package/dist/diagrams/mindmap/types.js +10 -0
  121. package/dist/diagrams/mindmap/types.js.map +1 -0
  122. package/dist/diagrams/packet/parser.d.ts +15 -0
  123. package/dist/diagrams/packet/parser.js +99 -0
  124. package/dist/diagrams/packet/parser.js.map +1 -0
  125. package/dist/diagrams/packet/translator.d.ts +14 -0
  126. package/dist/diagrams/packet/translator.js +66 -0
  127. package/dist/diagrams/packet/translator.js.map +1 -0
  128. package/dist/diagrams/packet/types.d.ts +14 -0
  129. package/dist/diagrams/packet/types.js +6 -0
  130. package/dist/diagrams/packet/types.js.map +1 -0
  131. package/dist/diagrams/pie/chart.d.ts +26 -0
  132. package/dist/diagrams/pie/chart.js +64 -0
  133. package/dist/diagrams/pie/chart.js.map +1 -0
  134. package/dist/diagrams/pie/parser.d.ts +18 -0
  135. package/dist/diagrams/pie/parser.js +93 -0
  136. package/dist/diagrams/pie/parser.js.map +1 -0
  137. package/dist/diagrams/pie/translator.d.ts +15 -0
  138. package/dist/diagrams/pie/translator.js +150 -0
  139. package/dist/diagrams/pie/translator.js.map +1 -0
  140. package/dist/diagrams/pie/types.d.ts +16 -0
  141. package/dist/diagrams/pie/types.js +6 -0
  142. package/dist/diagrams/pie/types.js.map +1 -0
  143. package/dist/diagrams/quadrant/parser.d.ts +24 -0
  144. package/dist/diagrams/quadrant/parser.js +96 -0
  145. package/dist/diagrams/quadrant/parser.js.map +1 -0
  146. package/dist/diagrams/quadrant/translator.d.ts +21 -0
  147. package/dist/diagrams/quadrant/translator.js +204 -0
  148. package/dist/diagrams/quadrant/translator.js.map +1 -0
  149. package/dist/diagrams/quadrant/types.d.ts +41 -0
  150. package/dist/diagrams/quadrant/types.js +10 -0
  151. package/dist/diagrams/quadrant/types.js.map +1 -0
  152. package/dist/diagrams/radar/chart.d.ts +21 -0
  153. package/dist/diagrams/radar/chart.js +65 -0
  154. package/dist/diagrams/radar/chart.js.map +1 -0
  155. package/dist/diagrams/radar/parser.d.ts +15 -0
  156. package/dist/diagrams/radar/parser.js +186 -0
  157. package/dist/diagrams/radar/parser.js.map +1 -0
  158. package/dist/diagrams/radar/translator.d.ts +12 -0
  159. package/dist/diagrams/radar/translator.js +98 -0
  160. package/dist/diagrams/radar/translator.js.map +1 -0
  161. package/dist/diagrams/radar/types.d.ts +29 -0
  162. package/dist/diagrams/radar/types.js +6 -0
  163. package/dist/diagrams/radar/types.js.map +1 -0
  164. package/dist/diagrams/requirement-diagram/parser.d.ts +29 -0
  165. package/dist/diagrams/requirement-diagram/parser.js +156 -0
  166. package/dist/diagrams/requirement-diagram/parser.js.map +1 -0
  167. package/dist/diagrams/requirement-diagram/translator.d.ts +24 -0
  168. package/dist/diagrams/requirement-diagram/translator.js +214 -0
  169. package/dist/diagrams/requirement-diagram/translator.js.map +1 -0
  170. package/dist/diagrams/requirement-diagram/types.d.ts +37 -0
  171. package/dist/diagrams/requirement-diagram/types.js +18 -0
  172. package/dist/diagrams/requirement-diagram/types.js.map +1 -0
  173. package/dist/diagrams/sankey/parser.d.ts +14 -0
  174. package/dist/diagrams/sankey/parser.js +123 -0
  175. package/dist/diagrams/sankey/parser.js.map +1 -0
  176. package/dist/diagrams/sankey/translator.d.ts +15 -0
  177. package/dist/diagrams/sankey/translator.js +132 -0
  178. package/dist/diagrams/sankey/translator.js.map +1 -0
  179. package/dist/diagrams/sankey/types.d.ts +16 -0
  180. package/dist/diagrams/sankey/types.js +6 -0
  181. package/dist/diagrams/sankey/types.js.map +1 -0
  182. package/dist/diagrams/sequence/parser.d.ts +22 -0
  183. package/dist/diagrams/sequence/parser.js +256 -0
  184. package/dist/diagrams/sequence/parser.js.map +1 -0
  185. package/dist/diagrams/sequence/translator.d.ts +21 -0
  186. package/dist/diagrams/sequence/translator.js +309 -0
  187. package/dist/diagrams/sequence/translator.js.map +1 -0
  188. package/dist/diagrams/sequence/types.d.ts +62 -0
  189. package/dist/diagrams/sequence/types.js +8 -0
  190. package/dist/diagrams/sequence/types.js.map +1 -0
  191. package/dist/diagrams/state-diagram/parser.d.ts +37 -0
  192. package/dist/diagrams/state-diagram/parser.js +215 -0
  193. package/dist/diagrams/state-diagram/parser.js.map +1 -0
  194. package/dist/diagrams/state-diagram/translator.d.ts +25 -0
  195. package/dist/diagrams/state-diagram/translator.js +165 -0
  196. package/dist/diagrams/state-diagram/translator.js.map +1 -0
  197. package/dist/diagrams/state-diagram/types.d.ts +38 -0
  198. package/dist/diagrams/state-diagram/types.js +13 -0
  199. package/dist/diagrams/state-diagram/types.js.map +1 -0
  200. package/dist/diagrams/timeline/parser.d.ts +17 -0
  201. package/dist/diagrams/timeline/parser.js +82 -0
  202. package/dist/diagrams/timeline/parser.js.map +1 -0
  203. package/dist/diagrams/timeline/translator.d.ts +13 -0
  204. package/dist/diagrams/timeline/translator.js +90 -0
  205. package/dist/diagrams/timeline/translator.js.map +1 -0
  206. package/dist/diagrams/timeline/types.d.ts +18 -0
  207. package/dist/diagrams/timeline/types.js +6 -0
  208. package/dist/diagrams/timeline/types.js.map +1 -0
  209. package/dist/diagrams/tree-view/parser.d.ts +16 -0
  210. package/dist/diagrams/tree-view/parser.js +129 -0
  211. package/dist/diagrams/tree-view/parser.js.map +1 -0
  212. package/dist/diagrams/tree-view/translator.d.ts +11 -0
  213. package/dist/diagrams/tree-view/translator.js +73 -0
  214. package/dist/diagrams/tree-view/translator.js.map +1 -0
  215. package/dist/diagrams/tree-view/types.d.ts +22 -0
  216. package/dist/diagrams/tree-view/types.js +6 -0
  217. package/dist/diagrams/tree-view/types.js.map +1 -0
  218. package/dist/diagrams/treemap/parser.d.ts +15 -0
  219. package/dist/diagrams/treemap/parser.js +131 -0
  220. package/dist/diagrams/treemap/parser.js.map +1 -0
  221. package/dist/diagrams/treemap/translator.d.ts +15 -0
  222. package/dist/diagrams/treemap/translator.js +136 -0
  223. package/dist/diagrams/treemap/translator.js.map +1 -0
  224. package/dist/diagrams/treemap/types.d.ts +22 -0
  225. package/dist/diagrams/treemap/types.js +6 -0
  226. package/dist/diagrams/treemap/types.js.map +1 -0
  227. package/dist/diagrams/venn/parser.d.ts +27 -0
  228. package/dist/diagrams/venn/parser.js +129 -0
  229. package/dist/diagrams/venn/parser.js.map +1 -0
  230. package/dist/diagrams/venn/translator.d.ts +25 -0
  231. package/dist/diagrams/venn/translator.js +214 -0
  232. package/dist/diagrams/venn/translator.js.map +1 -0
  233. package/dist/diagrams/venn/types.d.ts +33 -0
  234. package/dist/diagrams/venn/types.js +11 -0
  235. package/dist/diagrams/venn/types.js.map +1 -0
  236. package/dist/diagrams/wardley/parser.d.ts +14 -0
  237. package/dist/diagrams/wardley/parser.js +254 -0
  238. package/dist/diagrams/wardley/parser.js.map +1 -0
  239. package/dist/diagrams/wardley/translator.d.ts +15 -0
  240. package/dist/diagrams/wardley/translator.js +196 -0
  241. package/dist/diagrams/wardley/translator.js.map +1 -0
  242. package/dist/diagrams/wardley/types.d.ts +74 -0
  243. package/dist/diagrams/wardley/types.js +8 -0
  244. package/dist/diagrams/wardley/types.js.map +1 -0
  245. package/dist/diagrams/xychart/chart.d.ts +24 -0
  246. package/dist/diagrams/xychart/chart.js +113 -0
  247. package/dist/diagrams/xychart/chart.js.map +1 -0
  248. package/dist/diagrams/xychart/parser.d.ts +16 -0
  249. package/dist/diagrams/xychart/parser.js +190 -0
  250. package/dist/diagrams/xychart/parser.js.map +1 -0
  251. package/dist/diagrams/xychart/translator.d.ts +14 -0
  252. package/dist/diagrams/xychart/translator.js +187 -0
  253. package/dist/diagrams/xychart/translator.js.map +1 -0
  254. package/dist/diagrams/xychart/types.d.ts +32 -0
  255. package/dist/diagrams/xychart/types.js +6 -0
  256. package/dist/diagrams/xychart/types.js.map +1 -0
  257. package/dist/diagrams/zenuml/parser.d.ts +21 -0
  258. package/dist/diagrams/zenuml/parser.js +228 -0
  259. package/dist/diagrams/zenuml/parser.js.map +1 -0
  260. package/dist/index.d.ts +109 -0
  261. package/dist/index.js +189 -0
  262. package/dist/index.js.map +1 -0
  263. package/dist/label-runs.d.ts +16 -0
  264. package/dist/label-runs.js +30 -0
  265. package/dist/label-runs.js.map +1 -0
  266. package/dist/layout/layout.d.ts +53 -0
  267. package/dist/layout/layout.js +536 -0
  268. package/dist/layout/layout.js.map +1 -0
  269. package/dist/parser/diagram-type.d.ts +41 -0
  270. package/dist/parser/diagram-type.js +97 -0
  271. package/dist/parser/diagram-type.js.map +1 -0
  272. package/dist/parser/index.d.ts +2 -0
  273. package/dist/parser/index.js +2 -0
  274. package/dist/parser/index.js.map +1 -0
  275. package/dist/parser/parser.d.ts +25 -0
  276. package/dist/parser/parser.js +1134 -0
  277. package/dist/parser/parser.js.map +1 -0
  278. package/dist/render-diagram.d.ts +156 -0
  279. package/dist/render-diagram.js +326 -0
  280. package/dist/render-diagram.js.map +1 -0
  281. package/dist/rendering-plan.d.ts +47 -0
  282. package/dist/rendering-plan.js +43 -0
  283. package/dist/rendering-plan.js.map +1 -0
  284. package/dist/smartart/chain.d.ts +216 -0
  285. package/dist/smartart/chain.js +558 -0
  286. package/dist/smartart/chain.js.map +1 -0
  287. package/dist/smartart/classify.d.ts +96 -0
  288. package/dist/smartart/classify.js +162 -0
  289. package/dist/smartart/classify.js.map +1 -0
  290. package/dist/smartart/cycle.d.ts +91 -0
  291. package/dist/smartart/cycle.js +323 -0
  292. package/dist/smartart/cycle.js.map +1 -0
  293. package/dist/smartart/dispatch.d.ts +48 -0
  294. package/dist/smartart/dispatch.js +49 -0
  295. package/dist/smartart/dispatch.js.map +1 -0
  296. package/dist/smartart/drawing.d.ts +155 -0
  297. package/dist/smartart/drawing.js +574 -0
  298. package/dist/smartart/drawing.js.map +1 -0
  299. package/dist/smartart/embed.d.ts +78 -0
  300. package/dist/smartart/embed.js +136 -0
  301. package/dist/smartart/embed.js.map +1 -0
  302. package/dist/smartart/from-graph.d.ts +42 -0
  303. package/dist/smartart/from-graph.js +106 -0
  304. package/dist/smartart/from-graph.js.map +1 -0
  305. package/dist/smartart/from-timeline.d.ts +30 -0
  306. package/dist/smartart/from-timeline.js +59 -0
  307. package/dist/smartart/from-timeline.js.map +1 -0
  308. package/dist/smartart/from-tree.d.ts +36 -0
  309. package/dist/smartart/from-tree.js +74 -0
  310. package/dist/smartart/from-tree.js.map +1 -0
  311. package/dist/smartart/generate-options.d.ts +12 -0
  312. package/dist/smartart/generate-options.js +2 -0
  313. package/dist/smartart/generate-options.js.map +1 -0
  314. package/dist/smartart/kanban.d.ts +24 -0
  315. package/dist/smartart/kanban.js +250 -0
  316. package/dist/smartart/kanban.js.map +1 -0
  317. package/dist/smartart/node-shape.d.ts +16 -0
  318. package/dist/smartart/node-shape.js +22 -0
  319. package/dist/smartart/node-shape.js.map +1 -0
  320. package/dist/smartart/styles.d.ts +114 -0
  321. package/dist/smartart/styles.js +141 -0
  322. package/dist/smartart/styles.js.map +1 -0
  323. package/dist/smartart/text.d.ts +16 -0
  324. package/dist/smartart/text.js +48 -0
  325. package/dist/smartart/text.js.map +1 -0
  326. package/dist/smartart/timeline-grouped.d.ts +40 -0
  327. package/dist/smartart/timeline-grouped.js +279 -0
  328. package/dist/smartart/timeline-grouped.js.map +1 -0
  329. package/dist/smartart/timeline.d.ts +51 -0
  330. package/dist/smartart/timeline.js +276 -0
  331. package/dist/smartart/timeline.js.map +1 -0
  332. package/dist/smartart/tree-deep.d.ts +61 -0
  333. package/dist/smartart/tree-deep.js +293 -0
  334. package/dist/smartart/tree-deep.js.map +1 -0
  335. package/dist/smartart/tree.d.ts +159 -0
  336. package/dist/smartart/tree.js +497 -0
  337. package/dist/smartart/tree.js.map +1 -0
  338. package/dist/translator/boxes.d.ts +36 -0
  339. package/dist/translator/boxes.js +95 -0
  340. package/dist/translator/boxes.js.map +1 -0
  341. package/dist/translator/canvas.d.ts +82 -0
  342. package/dist/translator/canvas.js +135 -0
  343. package/dist/translator/canvas.js.map +1 -0
  344. package/dist/translator/graph-shapes.d.ts +98 -0
  345. package/dist/translator/graph-shapes.js +223 -0
  346. package/dist/translator/graph-shapes.js.map +1 -0
  347. package/dist/translator/native-chart.d.ts +64 -0
  348. package/dist/translator/native-chart.js +109 -0
  349. package/dist/translator/native-chart.js.map +1 -0
  350. package/dist/translator/ooxml-translator.d.ts +79 -0
  351. package/dist/translator/ooxml-translator.js +1213 -0
  352. package/dist/translator/ooxml-translator.js.map +1 -0
  353. package/dist/translator/path-shape.d.ts +11 -0
  354. package/dist/translator/path-shape.js +37 -0
  355. package/dist/translator/path-shape.js.map +1 -0
  356. package/dist/translator/unsupported-diagram-note.d.ts +16 -0
  357. package/dist/translator/unsupported-diagram-note.js +34 -0
  358. package/dist/translator/unsupported-diagram-note.js.map +1 -0
  359. package/dist/translator/xml-escape.d.ts +28 -0
  360. package/dist/translator/xml-escape.js +40 -0
  361. package/dist/translator/xml-escape.js.map +1 -0
  362. package/dist/types.d.ts +158 -0
  363. package/dist/types.js +9 -0
  364. package/dist/types.js.map +1 -0
  365. package/package.json +42 -0
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Build the `<w:p>` fragment that embeds a SmartArt diagram inline in
3
+ * `document.xml` — the SmartArt equivalent of `ooxml-translator.ts`'s
4
+ * `wrapInParagraph` for the `wpg:wgp` path, same overall shape (`w:p` >
5
+ * `w:r` > `w:drawing` > `wp:inline` > `a:graphic`), swapping the
6
+ * `wpc:wpc` canvas content for a `dgm:relIds` reference (spec §3).
7
+ *
8
+ * **Placeholder relationship ids, not real ones.** A SmartArt diagram's 4
9
+ * parts (`data`/`layout`/`colors`/`quickStyle`) don't exist as package
10
+ * relationships yet at the point this module runs — Pandoc's Lua filter API
11
+ * has no mechanism to add new `.docx` package parts or relationships
12
+ * (`docs/specs/FUTURE_mmd2smartart_SPEC.md` §2, confirmed by testing `pandoc.mediabag`).
13
+ * The `relIds` passed in here are therefore opaque caller-chosen strings
14
+ * (`packages/pandoc-filter/bin/md2nativedocx-core.mjs` uses
15
+ * `SMARTART_PLACEHOLDER:<uuid>:dm` etc.) that a later, package-aware step
16
+ * (`packages/cli/src/postprocess.mjs`, run after Pandoc has produced the
17
+ * `.docx`) finds, replaces with real `rId`s, and backs with real parts +
18
+ * relationships + `[Content_Types].xml` overrides. This module knows
19
+ * nothing about that protocol — it just needs *some* 4 strings to put in
20
+ * `r:dm`/`r:lo`/`r:qs`/`r:cs`, real or not.
21
+ *
22
+ * `wp:docPr/@id` is left as `"1"` deliberately, not computed here: the
23
+ * existing document-wide renumbering pass (`postprocess.mjs`'s
24
+ * `renumberDrawingIds`) already treats every `<w:drawing>` block's
25
+ * `wp:docPr`/`cNvPr` ids as one shared id space and renumbers them without
26
+ * caring which translator produced the block — the same mechanism that
27
+ * already resolves collisions between multiple `wpg:wgp` diagrams handles a
28
+ * SmartArt diagram for free.
29
+ */
30
+ import type { SmartArtIneligible } from './classify.js';
31
+ /** The 4 relationship ids (real or placeholder) a SmartArt `dgm:relIds` needs. */
32
+ export interface SmartArtRelIds {
33
+ /** `r:dm` — `diagramData`. */
34
+ dm: string;
35
+ /** `r:lo` — `diagramLayout`. */
36
+ lo: string;
37
+ /** `r:qs` — `diagramQuickStyle`. */
38
+ qs: string;
39
+ /** `r:cs` — `diagramColors`. */
40
+ cs: string;
41
+ }
42
+ export interface SmartArtEmbedOptions {
43
+ /** `wp:extent/@cx` in EMU. Default ~6 in — matches the spike's own frame size. */
44
+ widthEmu?: number;
45
+ /** `wp:extent/@cy` in EMU. Default ~3.33 in. */
46
+ heightEmu?: number;
47
+ /** `wp:docPr/@name` — cosmetic only (Word's alt-text/selection UI). */
48
+ name?: string;
49
+ }
50
+ /**
51
+ * Build the `<w:p>` fragment referencing `relIds`. Deliberately a **fixed**
52
+ * frame size (not content-aware, unlike the `wpg:wgp` path's
53
+ * `computeBoundingBox`/`scaledExtent`): Word computes the SmartArt's
54
+ * internal shape geometry itself at open-time from `data`+`layout`, so
55
+ * there's no equivalent bounding-box calculation to run ahead of time here.
56
+ * A future refinement could scale `widthEmu` with node count for `chain`
57
+ * (more items need more horizontal room) — not attempted, kept out of scope
58
+ * for wiring the dispatch.
59
+ */
60
+ export declare function buildSmartArtDrawingXml(relIds: SmartArtRelIds, options?: SmartArtEmbedOptions): string;
61
+ /**
62
+ * Build the fallback-note `<w:p>` placed directly under a diagram that was
63
+ * attempted for SmartArt but rejected by {@link classifyTopology}
64
+ * (`docs/specs/FUTURE_mmd2smartart_SPEC.md` §10.3 — "phrase sous le graphe" was chosen
65
+ * over a `w:comment` because it's the only option guaranteed to survive a
66
+ * PDF export). Callers (`packages/pandoc-filter/bin/md2nativedocx-core.mjs`)
67
+ * must only emit this when SmartArt was actually attempted and rejected —
68
+ * never for a diagram that succeeded as SmartArt, and never for the default
69
+ * `wpg:wgp` pipeline when SmartArt wasn't attempted at all.
70
+ *
71
+ * Uses direct run formatting (italic, gray, smaller size) rather than a
72
+ * named paragraph style, so it renders correctly regardless of which
73
+ * `--reference-doc` produced the surrounding document — spec §10.3's "style
74
+ * discret dédié ... ou équivalent" explicitly allows this. The text is
75
+ * still a single, contiguous run, easy to select and delete in Word before
76
+ * final distribution.
77
+ */
78
+ export declare function buildSmartArtFallbackNoteXml(classification: SmartArtIneligible): string;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Build the `<w:p>` fragment that embeds a SmartArt diagram inline in
3
+ * `document.xml` — the SmartArt equivalent of `ooxml-translator.ts`'s
4
+ * `wrapInParagraph` for the `wpg:wgp` path, same overall shape (`w:p` >
5
+ * `w:r` > `w:drawing` > `wp:inline` > `a:graphic`), swapping the
6
+ * `wpc:wpc` canvas content for a `dgm:relIds` reference (spec §3).
7
+ *
8
+ * **Placeholder relationship ids, not real ones.** A SmartArt diagram's 4
9
+ * parts (`data`/`layout`/`colors`/`quickStyle`) don't exist as package
10
+ * relationships yet at the point this module runs — Pandoc's Lua filter API
11
+ * has no mechanism to add new `.docx` package parts or relationships
12
+ * (`docs/specs/FUTURE_mmd2smartart_SPEC.md` §2, confirmed by testing `pandoc.mediabag`).
13
+ * The `relIds` passed in here are therefore opaque caller-chosen strings
14
+ * (`packages/pandoc-filter/bin/md2nativedocx-core.mjs` uses
15
+ * `SMARTART_PLACEHOLDER:<uuid>:dm` etc.) that a later, package-aware step
16
+ * (`packages/cli/src/postprocess.mjs`, run after Pandoc has produced the
17
+ * `.docx`) finds, replaces with real `rId`s, and backs with real parts +
18
+ * relationships + `[Content_Types].xml` overrides. This module knows
19
+ * nothing about that protocol — it just needs *some* 4 strings to put in
20
+ * `r:dm`/`r:lo`/`r:qs`/`r:cs`, real or not.
21
+ *
22
+ * `wp:docPr/@id` is left as `"1"` deliberately, not computed here: the
23
+ * existing document-wide renumbering pass (`postprocess.mjs`'s
24
+ * `renumberDrawingIds`) already treats every `<w:drawing>` block's
25
+ * `wp:docPr`/`cNvPr` ids as one shared id space and renumbers them without
26
+ * caring which translator produced the block — the same mechanism that
27
+ * already resolves collisions between multiple `wpg:wgp` diagrams handles a
28
+ * SmartArt diagram for free.
29
+ */
30
+ import { escapeXml } from '../translator/xml-escape.js';
31
+ const WP_NS = 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing';
32
+ const A_NS = 'http://schemas.openxmlformats.org/drawingml/2006/main';
33
+ const R_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
34
+ const DGM_NS = 'http://schemas.openxmlformats.org/drawingml/2006/diagram';
35
+ const DIAGRAM_GRAPHIC_URI = 'http://schemas.openxmlformats.org/drawingml/2006/diagram';
36
+ const DEFAULT_WIDTH_EMU = 5486400;
37
+ const DEFAULT_HEIGHT_EMU = 3200400;
38
+ /**
39
+ * Build the `<w:p>` fragment referencing `relIds`. Deliberately a **fixed**
40
+ * frame size (not content-aware, unlike the `wpg:wgp` path's
41
+ * `computeBoundingBox`/`scaledExtent`): Word computes the SmartArt's
42
+ * internal shape geometry itself at open-time from `data`+`layout`, so
43
+ * there's no equivalent bounding-box calculation to run ahead of time here.
44
+ * A future refinement could scale `widthEmu` with node count for `chain`
45
+ * (more items need more horizontal room) — not attempted, kept out of scope
46
+ * for wiring the dispatch.
47
+ */
48
+ export function buildSmartArtDrawingXml(relIds, options = {}) {
49
+ const cx = options.widthEmu ?? DEFAULT_WIDTH_EMU;
50
+ const cy = options.heightEmu ?? DEFAULT_HEIGHT_EMU;
51
+ const name = options.name ?? 'SmartArt Diagram';
52
+ return [
53
+ '<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">',
54
+ ' <w:r>',
55
+ ' <w:drawing>',
56
+ ` <wp:inline xmlns:wp="${WP_NS}" distT="0" distB="0" distL="0" distR="0">`,
57
+ ` <wp:extent cx="${cx}" cy="${cy}"/>`,
58
+ ' <wp:effectExtent l="0" t="0" r="0" b="0"/>',
59
+ ` <wp:docPr id="1" name="${name}"/>`,
60
+ ' <wp:cNvGraphicFramePr/>',
61
+ ` <a:graphic xmlns:a="${A_NS}">`,
62
+ ` <a:graphicData uri="${DIAGRAM_GRAPHIC_URI}">`,
63
+ ` <dgm:relIds xmlns:dgm="${DGM_NS}" xmlns:r="${R_NS}" ` +
64
+ `r:dm="${relIds.dm}" r:lo="${relIds.lo}" r:qs="${relIds.qs}" r:cs="${relIds.cs}"/>`,
65
+ ' </a:graphicData>',
66
+ ' </a:graphic>',
67
+ ' </wp:inline>',
68
+ ' </w:drawing>',
69
+ ' </w:r>',
70
+ '</w:p>',
71
+ ].join('\n');
72
+ }
73
+ /**
74
+ * Build the fallback-note `<w:p>` placed directly under a diagram that was
75
+ * attempted for SmartArt but rejected by {@link classifyTopology}
76
+ * (`docs/specs/FUTURE_mmd2smartart_SPEC.md` §10.3 — "phrase sous le graphe" was chosen
77
+ * over a `w:comment` because it's the only option guaranteed to survive a
78
+ * PDF export). Callers (`packages/pandoc-filter/bin/md2nativedocx-core.mjs`)
79
+ * must only emit this when SmartArt was actually attempted and rejected —
80
+ * never for a diagram that succeeded as SmartArt, and never for the default
81
+ * `wpg:wgp` pipeline when SmartArt wasn't attempted at all.
82
+ *
83
+ * Uses direct run formatting (italic, gray, smaller size) rather than a
84
+ * named paragraph style, so it renders correctly regardless of which
85
+ * `--reference-doc` produced the surrounding document — spec §10.3's "style
86
+ * discret dédié ... ou équivalent" explicitly allows this. The text is
87
+ * still a single, contiguous run, easy to select and delete in Word before
88
+ * final distribution.
89
+ */
90
+ export function buildSmartArtFallbackNoteXml(classification) {
91
+ const message = escapeXml(fallbackMessage(classification));
92
+ return [
93
+ '<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">',
94
+ ' <w:pPr>',
95
+ ' <w:spacing w:before="0" w:after="120"/>',
96
+ ' </w:pPr>',
97
+ ' <w:r>',
98
+ ' <w:rPr>',
99
+ ' <w:i/>',
100
+ ' <w:color w:val="808080"/>',
101
+ ' <w:sz w:val="18"/>',
102
+ ' </w:rPr>',
103
+ ` <w:t xml:space="preserve">${message}</w:t>`,
104
+ ' </w:r>',
105
+ '</w:p>',
106
+ ].join('\n');
107
+ }
108
+ /** Specific, actionable text per {@link SmartArtIneligibleReason} (spec
109
+ * §10.3: never a generic "auto-generated, may contain errors" disclaimer). */
110
+ function fallbackMessage(classification) {
111
+ const { reason, at } = classification;
112
+ switch (reason) {
113
+ case 'merge-after-branch':
114
+ return `Native shapes used (merge detected between ${formatAt(at)} — not supported by SmartArt export).`;
115
+ case 'subgraph':
116
+ return 'Native shapes used (nested subgraph detected — not supported by SmartArt export).';
117
+ case 'self-loop':
118
+ return `Native shapes used (self-loop detected at ${formatAt(at)} — not supported by SmartArt export).`;
119
+ case 'disconnected':
120
+ return 'Native shapes used (diagram has multiple disconnected parts — not supported by SmartArt export).';
121
+ case 'tree-too-deep':
122
+ return `Native shapes used (hierarchy under ${formatAt(at)} is deeper than SmartArt export supports (at most 10 levels)).`;
123
+ case 'irregular-topology':
124
+ return 'Native shapes used (diagram shape not recognized by SmartArt export).';
125
+ }
126
+ }
127
+ /** Quote and join node ids for a message, e.g. `"B" and "E"`. */
128
+ function formatAt(at) {
129
+ const quoted = at.map((id) => `"${id}"`);
130
+ if (quoted.length === 0)
131
+ return '';
132
+ if (quoted.length === 1)
133
+ return quoted[0];
134
+ return `${quoted.slice(0, -1).join(', ')} and ${quoted[quoted.length - 1]}`;
135
+ }
136
+ //# sourceMappingURL=embed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.js","sourceRoot":"","sources":["../../src/smartart/embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,MAAM,KAAK,GAAG,wEAAwE,CAAC;AACvF,MAAM,IAAI,GAAG,uDAAuD,CAAC;AACrE,MAAM,IAAI,GAAG,qEAAqE,CAAC;AACnF,MAAM,MAAM,GAAG,0DAA0D,CAAC;AAC1E,MAAM,mBAAmB,GAAG,0DAA0D,CAAC;AAuBvF,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAsB,EAAE,UAAgC,EAAE;IAChG,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CA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uCAAuC,CAAC;QAC3G,KAAK,UAAU;YACb,OAAO,mFAAmF,CAAC;QAC7F,KAAK,WAAW;YACd,OAAO,6CAA6C,QAAQ,CAAC,EAAE,CAAC,uCAAuC,CAAC;QAC1G,KAAK,cAAc;YACjB,OAAO,kGAAkG,CAAC;QAC5G,KAAK,eAAe;YAClB,OAAO,uCAAuC,QAAQ,CAAC,EAAE,CAAC,gEAAgE,CAAC;QAC7H,KAAK,oBAAoB;YACvB,OAAO,uEAAuE,CAAC;IACnF,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,SAAS,QAAQ,CAAC,EAAY;IAC5B,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAE,CAAC;IAC3C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * SmartArt for three Mermaid diagram types whose small, simple cases are a chain, a cycle or a tree — turned
3
+ * into the {@link Flowchart} shape the validated generators read, then classified like a flowchart:
4
+ *
5
+ * - `gitGraph` with only the main branch (no branch, no cherry-pick): a process, one box per commit (its id in
6
+ * bold, its tag under it). Lost: the commit dots and their types (highlight, reverse).
7
+ * - `stateDiagram` whose states form a chain or a loop, once the `[*]` start/end markers are set aside (no
8
+ * choice/fork/join): a process or a cycle, transition labels folded into the box text (`label : state`).
9
+ * Lost: the start/end markers. A tree-shaped state machine is not turned into an org chart.
10
+ * - `classDiagram` made only of inheritance forming a single tree: a hierarchy, superclass on top, each box
11
+ * holding the class name in bold then its attributes and methods. Lost: the UML compartments' separators.
12
+ *
13
+ * Anything else keeps its shape-built rendering.
14
+ */
15
+ import type { Flowchart } from '../types.js';
16
+ import type { GitGraphDiagram } from '../diagrams/git-graph/types.js';
17
+ import type { StateDiagram } from '../diagrams/state-diagram/types.js';
18
+ import type { ClassDiagram } from '../diagrams/class-diagram/types.js';
19
+ import { type SmartArtLayout } from './classify.js';
20
+ import { type SmartArtGenerated } from './dispatch.js';
21
+ import type { SmartArtGenerateOptions } from './generate-options.js';
22
+ /** The chain of a main-branch-only git history, or `null`. */
23
+ export declare function gitGraphToFlowchart(diagram: GitGraphDiagram): Flowchart | null;
24
+ /** The graph of a state machine's ordinary states (start/end markers set aside), or `null` with a choice/fork/join. */
25
+ export declare function stateDiagramToFlowchart(diagram: StateDiagram): Flowchart | null;
26
+ /** The superclass → subclass tree of an inheritance-only class diagram, or `null` with any other relation. */
27
+ export declare function classDiagramToFlowchart(diagram: ClassDiagram): Flowchart | null;
28
+ /** SmartArt layout a git graph gets (`chain`), or `null`. */
29
+ export declare function gitGraphSmartArtLayout(diagram: GitGraphDiagram): SmartArtLayout | null;
30
+ /** SmartArt layout a state diagram gets (`chain` or `cycle`), or `null`. */
31
+ export declare function stateDiagramSmartArtLayout(diagram: StateDiagram): SmartArtLayout | null;
32
+ /**
33
+ * SmartArt layout a class diagram gets (`tree`), or `null`. A single line of inheritance (`A <|-- B <|-- C`) is a
34
+ * chain to the flowchart classifier, but still a hierarchy here, as a straight-line mindmap is.
35
+ */
36
+ export declare function classDiagramSmartArtLayout(diagram: ClassDiagram): SmartArtLayout | null;
37
+ /** SmartArt parts for a main-branch-only `gitGraph`, or `null`. */
38
+ export declare function generateGitGraphSmartArt(diagram: GitGraphDiagram, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
39
+ /** SmartArt parts for a chain- or loop-shaped `stateDiagram`, or `null`. */
40
+ export declare function generateStateDiagramSmartArt(diagram: StateDiagram, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
41
+ /** SmartArt parts for an inheritance-tree `classDiagram`, or `null`. */
42
+ export declare function generateClassDiagramSmartArt(diagram: ClassDiagram, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * SmartArt for three Mermaid diagram types whose small, simple cases are a chain, a cycle or a tree — turned
3
+ * into the {@link Flowchart} shape the validated generators read, then classified like a flowchart:
4
+ *
5
+ * - `gitGraph` with only the main branch (no branch, no cherry-pick): a process, one box per commit (its id in
6
+ * bold, its tag under it). Lost: the commit dots and their types (highlight, reverse).
7
+ * - `stateDiagram` whose states form a chain or a loop, once the `[*]` start/end markers are set aside (no
8
+ * choice/fork/join): a process or a cycle, transition labels folded into the box text (`label : state`).
9
+ * Lost: the start/end markers. A tree-shaped state machine is not turned into an org chart.
10
+ * - `classDiagram` made only of inheritance forming a single tree: a hierarchy, superclass on top, each box
11
+ * holding the class name in bold then its attributes and methods. Lost: the UML compartments' separators.
12
+ *
13
+ * Anything else keeps its shape-built rendering.
14
+ */
15
+ import { classifyTopology } from './classify.js';
16
+ import { generateSmartArt } from './dispatch.js';
17
+ import { treeSmartArt } from './from-tree.js';
18
+ function node(id, labelRuns) {
19
+ const label = labelRuns.map((t) => ('break' in t ? ' ' : t.text)).join('');
20
+ return { id, label, labelRuns, shape: 'roundRect' };
21
+ }
22
+ function edge(from, to, label) {
23
+ return { from, to, type: 'arrow', label: label ?? null, labelRuns: label ? [{ text: label }] : null };
24
+ }
25
+ /** Bold first line, then plain lines. */
26
+ function lines(title, rest) {
27
+ const tokens = [{ text: title, bold: true }];
28
+ for (const line of rest)
29
+ tokens.push({ break: true }, { text: line });
30
+ return tokens;
31
+ }
32
+ /** The chain of a main-branch-only git history, or `null`. */
33
+ export function gitGraphToFlowchart(diagram) {
34
+ if (diagram.branches.length !== 1 || diagram.commits.length < 2)
35
+ return null;
36
+ if (diagram.commits.some((c) => c.cherryPickFrom !== undefined || c.parents.length > 1))
37
+ return null;
38
+ const commits = [...diagram.commits].sort((a, b) => a.seq - b.seq);
39
+ const nodes = commits.map((c, i) => node(`c${i}`, lines(c.id, c.tag ? [c.tag] : [])));
40
+ const edges = nodes.slice(1).map((n, i) => edge(`c${i}`, n.id));
41
+ const direction = diagram.orientation === 'TB' ? 'TD' : diagram.orientation;
42
+ return { direction, nodes, edges, subgraphs: [] };
43
+ }
44
+ /** The graph of a state machine's ordinary states (start/end markers set aside), or `null` with a choice/fork/join. */
45
+ export function stateDiagramToFlowchart(diagram) {
46
+ if (diagram.states.some((s) => s.kind === 'choice' || s.kind === 'fork' || s.kind === 'join'))
47
+ return null;
48
+ const normal = diagram.states.filter((s) => s.kind === 'normal');
49
+ const ids = new Set(normal.map((s) => s.id));
50
+ const nodes = normal.map((s) => node(s.id, [{ text: s.label }]));
51
+ const edges = diagram.transitions.filter((t) => ids.has(t.from) && ids.has(t.to)).map((t) => edge(t.from, t.to, t.label));
52
+ return { direction: diagram.direction, nodes, edges, subgraphs: [] };
53
+ }
54
+ function member(m) {
55
+ return `${m.visibility ?? ''}${m.text}`;
56
+ }
57
+ /** The superclass → subclass tree of an inheritance-only class diagram, or `null` with any other relation. */
58
+ export function classDiagramToFlowchart(diagram) {
59
+ if (diagram.relationships.length === 0 || diagram.relationships.some((r) => r.type !== 'inheritance'))
60
+ return null;
61
+ const nodes = diagram.classes.map((c) => node(c.id, lines(c.label, [...c.attributes, ...c.methods].map(member))));
62
+ // The triangle marks the superclass: `Animal <|-- Duck` has its marker on `from`.
63
+ const edges = diagram.relationships.map((r) => (r.markerEnd === 'to' ? edge(r.to, r.from, r.label) : edge(r.from, r.to, r.label)));
64
+ return { direction: diagram.direction, nodes, edges, subgraphs: [] };
65
+ }
66
+ /** The SmartArt layout `flowchart` would get, restricted to `allowed`, or `null`. */
67
+ function layoutOf(flowchart, allowed) {
68
+ if (!flowchart || flowchart.nodes.length < 2)
69
+ return null;
70
+ const c = classifyTopology(flowchart);
71
+ return c.eligible && allowed.includes(c.layout) ? c.layout : null;
72
+ }
73
+ const GIT_LAYOUTS = ['chain'];
74
+ const STATE_LAYOUTS = ['chain', 'cycle'];
75
+ const CLASS_LAYOUTS = ['chain', 'tree'];
76
+ /** SmartArt layout a git graph gets (`chain`), or `null`. */
77
+ export function gitGraphSmartArtLayout(diagram) {
78
+ return layoutOf(gitGraphToFlowchart(diagram), GIT_LAYOUTS);
79
+ }
80
+ /** SmartArt layout a state diagram gets (`chain` or `cycle`), or `null`. */
81
+ export function stateDiagramSmartArtLayout(diagram) {
82
+ return layoutOf(stateDiagramToFlowchart(diagram), STATE_LAYOUTS);
83
+ }
84
+ /**
85
+ * SmartArt layout a class diagram gets (`tree`), or `null`. A single line of inheritance (`A <|-- B <|-- C`) is a
86
+ * chain to the flowchart classifier, but still a hierarchy here, as a straight-line mindmap is.
87
+ */
88
+ export function classDiagramSmartArtLayout(diagram) {
89
+ return layoutOf(classDiagramToFlowchart(diagram), CLASS_LAYOUTS) ? 'tree' : null;
90
+ }
91
+ /** SmartArt parts for a main-branch-only `gitGraph`, or `null`. */
92
+ export function generateGitGraphSmartArt(diagram, options = {}) {
93
+ const flowchart = gitGraphToFlowchart(diagram);
94
+ return flowchart && layoutOf(flowchart, GIT_LAYOUTS) ? generateSmartArt(flowchart, options) : null;
95
+ }
96
+ /** SmartArt parts for a chain- or loop-shaped `stateDiagram`, or `null`. */
97
+ export function generateStateDiagramSmartArt(diagram, options = {}) {
98
+ const flowchart = stateDiagramToFlowchart(diagram);
99
+ return flowchart && layoutOf(flowchart, STATE_LAYOUTS) ? generateSmartArt(flowchart, options) : null;
100
+ }
101
+ /** SmartArt parts for an inheritance-tree `classDiagram`, or `null`. */
102
+ export function generateClassDiagramSmartArt(diagram, options = {}) {
103
+ const flowchart = classDiagramToFlowchart(diagram);
104
+ return flowchart && layoutOf(flowchart, CLASS_LAYOUTS) ? treeSmartArt(flowchart, options) : null;
105
+ }
106
+ //# sourceMappingURL=from-graph.js.map
@@ -0,0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EAAE,UAAmC,EAAE;IACvG,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,SAAS,IAAI,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvG,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,4BAA4B,CAAC,OAAqB,EAAE,UAAmC,EAAE;IACvG,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,SAAS,IAAI,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACnG,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SmartArt time lines for Mermaid `timeline` and `journey`.
3
+ *
4
+ * - A `timeline` without sections: `timeline.ts` — an axis, a dot per period, the period and its events in a box
5
+ * above or below.
6
+ * - A `timeline` with sections, and every `journey`: `timeline-grouped.ts` — one arrow-ended bar per section
7
+ * with the steps as cards above and below. A journey task's card holds the task (bold), its score as stars
8
+ * (★★★★☆ for 4) and its actors.
9
+ *
10
+ * The title is never part of the SmartArt (the caller writes it as a paragraph above). A diagram too crowded for
11
+ * whole words at 10 pt keeps its shape-built rendering.
12
+ */
13
+ import type { LabelToken } from '../types.js';
14
+ import type { TimelineChart } from '../diagrams/timeline/types.js';
15
+ import type { JourneyChart } from '../diagrams/journey/types.js';
16
+ import type { SmartArtGenerated } from './dispatch.js';
17
+ import type { SmartArtGenerateOptions } from './generate-options.js';
18
+ /** A journey task's card text: the task in bold, its score as stars, its actors. */
19
+ export declare function journeyTaskText(label: string, score: number, actors: string[]): LabelToken[];
20
+ /** Whether `chart` becomes a SmartArt time line (enough room for whole words; a plain one needs two periods). */
21
+ export declare function timelineFitsSmartArt(chart: TimelineChart): boolean;
22
+ /**
23
+ * SmartArt parts for a parsed `timeline`, or `null` when it cannot be one ({@link timelineFitsSmartArt}): the
24
+ * caller then keeps the shape-built timeline. The title is not in the parts.
25
+ */
26
+ export declare function generateTimelineSmartArt(chart: TimelineChart, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
27
+ /** Whether `chart` becomes a SmartArt time line (at least one task, enough room for whole words). */
28
+ export declare function journeyFitsSmartArt(chart: JourneyChart): boolean;
29
+ /** SmartArt parts for a parsed `journey`, or `null` ({@link journeyFitsSmartArt}). The title is not in the parts. */
30
+ export declare function generateJourneySmartArt(chart: JourneyChart, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * SmartArt time lines for Mermaid `timeline` and `journey`.
3
+ *
4
+ * - A `timeline` without sections: `timeline.ts` — an axis, a dot per period, the period and its events in a box
5
+ * above or below.
6
+ * - A `timeline` with sections, and every `journey`: `timeline-grouped.ts` — one arrow-ended bar per section
7
+ * with the steps as cards above and below. A journey task's card holds the task (bold), its score as stars
8
+ * (★★★★☆ for 4) and its actors.
9
+ *
10
+ * The title is never part of the SmartArt (the caller writes it as a paragraph above). A diagram too crowded for
11
+ * whole words at 10 pt keeps its shape-built rendering.
12
+ */
13
+ import { generateTimeline, periodText, timelineTextFits } from './timeline.js';
14
+ import { generateGroupedTimeline, groupedTimelineTextFits } from './timeline-grouped.js';
15
+ /** Items grouped by section index in section order; items outside any section (-1) form a leading unnamed group. */
16
+ function group(sections, items, text) {
17
+ const groups = [];
18
+ const loose = items.filter((it) => it.sectionIndex < 0);
19
+ if (loose.length > 0)
20
+ groups.push({ label: '', steps: loose.map(text) });
21
+ sections.forEach((label, i) => groups.push({ label, steps: items.filter((it) => it.sectionIndex === i).map(text) }));
22
+ return groups;
23
+ }
24
+ /** The sections of a timeline that has some, else `null`. */
25
+ function timelineGroups(chart) {
26
+ return chart.sections.length > 0 ? group(chart.sections, chart.periods, (p) => periodText(p.label, p.events)) : null;
27
+ }
28
+ /** A journey task's card text: the task in bold, its score as stars, its actors. */
29
+ export function journeyTaskText(label, score, actors) {
30
+ const stars = Math.max(0, Math.min(5, Math.round(score)));
31
+ return periodText(label, ['★'.repeat(stars) + '☆'.repeat(5 - stars), ...(actors.length > 0 ? [actors.join(', ')] : [])]);
32
+ }
33
+ function journeyGroups(chart) {
34
+ return group(chart.sections, chart.tasks, (t) => journeyTaskText(t.label, t.score, t.actors));
35
+ }
36
+ /** Whether `chart` becomes a SmartArt time line (enough room for whole words; a plain one needs two periods). */
37
+ export function timelineFitsSmartArt(chart) {
38
+ const groups = timelineGroups(chart);
39
+ return groups ? groupedTimelineTextFits(groups) : timelineTextFits(chart);
40
+ }
41
+ /**
42
+ * SmartArt parts for a parsed `timeline`, or `null` when it cannot be one ({@link timelineFitsSmartArt}): the
43
+ * caller then keeps the shape-built timeline. The title is not in the parts.
44
+ */
45
+ export function generateTimelineSmartArt(chart, options = {}) {
46
+ if (!timelineFitsSmartArt(chart))
47
+ return null;
48
+ const groups = timelineGroups(chart);
49
+ return { layout: 'timeline', ...(groups ? generateGroupedTimeline(groups, options) : generateTimeline(chart, options)) };
50
+ }
51
+ /** Whether `chart` becomes a SmartArt time line (at least one task, enough room for whole words). */
52
+ export function journeyFitsSmartArt(chart) {
53
+ return groupedTimelineTextFits(journeyGroups(chart));
54
+ }
55
+ /** SmartArt parts for a parsed `journey`, or `null` ({@link journeyFitsSmartArt}). The title is not in the parts. */
56
+ export function generateJourneySmartArt(chart, options = {}) {
57
+ return journeyFitsSmartArt(chart) ? { layout: 'timeline', ...generateGroupedTimeline(journeyGroups(chart), options) } : null;
58
+ }
59
+ //# sourceMappingURL=from-timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from-timeline.js","sourceRoot":"","sources":["../../src/smartart/from-timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,e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AAK,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;AAC3H,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,mBAAmB,CAAC,KAAmB;IACrD,OAAO,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,qHAAqH;AACrH,MAAM,UAAU,uBAAuB,CAAC,KAAmB,EAAE,UAAmC,EAAE;IAChG,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,uBAAuB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/H,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * SmartArt for Mermaid diagram types that are already trees: `mindmap` and `treeView-beta`.
3
+ *
4
+ * Neither needs its own SmartArt generator. Each is turned into the {@link Flowchart} shape the tree
5
+ * generators read (one node per item, one parent→child edge) and handed straight to them, so it gets
6
+ * exactly the hierarchy validated in real Word for flowcharts: two levels through `tree.ts`, deeper through
7
+ * `tree-deep.ts`, the compact org-chart layout when wide, every look profile. Not through the flowchart
8
+ * classifier: a mindmap that happens to be a straight line is still a hierarchy, never a `chain` with
9
+ * process arrows.
10
+ *
11
+ * Direction: a mindmap grows left to right (`LR`), the way a mind map reads; a file tree goes top-down
12
+ * (`TD`), where the compact layout stacks each folder's files in a column under it, like a file explorer.
13
+ *
14
+ * What SmartArt cannot keep, and the shape-built translators do: the mindmap's radial layout and node
15
+ * shapes (circle, cloud, bang…), the file tree's bold folders and italic descriptions (the description is
16
+ * folded into the box text instead). A `treeView` with several top-level entries is not one tree and is
17
+ * left to the shape-built translator.
18
+ */
19
+ import type { Flowchart } from '../types.js';
20
+ import type { MindmapChart } from '../diagrams/mindmap/types.js';
21
+ import type { TreeViewDiagram } from '../diagrams/tree-view/types.js';
22
+ import type { SmartArtGenerated } from './dispatch.js';
23
+ import type { SmartArtGenerateOptions } from './generate-options.js';
24
+ /** The flowchart-shaped tree of a mindmap (`LR`), or `null` for an empty one. */
25
+ export declare function mindmapToFlowchart(chart: MindmapChart): Flowchart | null;
26
+ /** The flowchart-shaped tree of a file tree (`TD`), or `null` unless it has exactly one top-level entry. */
27
+ export declare function treeViewToFlowchart(diagram: TreeViewDiagram): Flowchart | null;
28
+ /** The tree generators for a flowchart-shaped tree, or `null` below 2 nodes or past `MAX_TREE_DEPTH`. */
29
+ export declare function treeSmartArt(flowchart: Flowchart | null, options: SmartArtGenerateOptions): SmartArtGenerated | null;
30
+ /**
31
+ * SmartArt parts for a parsed `mindmap`, or `null` when it is empty or not representable (a single
32
+ * node, more than `MAX_TREE_DEPTH` levels): the caller then keeps the shape-built mindmap.
33
+ */
34
+ export declare function generateMindmapSmartArt(chart: MindmapChart, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
35
+ /** SmartArt parts for a parsed `treeView-beta`, or `null` (several top-level entries, too deep…). */
36
+ export declare function generateTreeViewSmartArt(diagram: TreeViewDiagram, options?: SmartArtGenerateOptions): SmartArtGenerated | null;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * SmartArt for Mermaid diagram types that are already trees: `mindmap` and `treeView-beta`.
3
+ *
4
+ * Neither needs its own SmartArt generator. Each is turned into the {@link Flowchart} shape the tree
5
+ * generators read (one node per item, one parent→child edge) and handed straight to them, so it gets
6
+ * exactly the hierarchy validated in real Word for flowcharts: two levels through `tree.ts`, deeper through
7
+ * `tree-deep.ts`, the compact org-chart layout when wide, every look profile. Not through the flowchart
8
+ * classifier: a mindmap that happens to be a straight line is still a hierarchy, never a `chain` with
9
+ * process arrows.
10
+ *
11
+ * Direction: a mindmap grows left to right (`LR`), the way a mind map reads; a file tree goes top-down
12
+ * (`TD`), where the compact layout stacks each folder's files in a column under it, like a file explorer.
13
+ *
14
+ * What SmartArt cannot keep, and the shape-built translators do: the mindmap's radial layout and node
15
+ * shapes (circle, cloud, bang…), the file tree's bold folders and italic descriptions (the description is
16
+ * folded into the box text instead). A `treeView` with several top-level entries is not one tree and is
17
+ * left to the shape-built translator.
18
+ */
19
+ import { MAX_TREE_DEPTH, flowchartTreeDepth } from './classify.js';
20
+ import { generateTree } from './tree.js';
21
+ import { generateDeepTree } from './tree-deep.js';
22
+ function node(id, label, fill) {
23
+ return { id, label, labelRuns: [{ text: label }], shape: 'roundRect', ...(fill ? { fill } : {}) };
24
+ }
25
+ function edge(from, to) {
26
+ return { from, to, type: 'line', label: null, labelRuns: null };
27
+ }
28
+ /** The flowchart-shaped tree of a mindmap (`LR`), or `null` for an empty one. */
29
+ export function mindmapToFlowchart(chart) {
30
+ if (!chart.root)
31
+ return null;
32
+ const nodes = [];
33
+ const edges = [];
34
+ // Ids are positional: mindmap ids are optional and may repeat.
35
+ const walk = (n, parent) => {
36
+ const id = `m${nodes.length}`;
37
+ nodes.push(node(id, n.label));
38
+ if (parent !== undefined)
39
+ edges.push(edge(parent, id));
40
+ for (const child of n.children)
41
+ walk(child, id);
42
+ };
43
+ walk(chart.root, undefined);
44
+ return { direction: 'LR', nodes, edges, subgraphs: [] };
45
+ }
46
+ /** The flowchart-shaped tree of a file tree (`TD`), or `null` unless it has exactly one top-level entry. */
47
+ export function treeViewToFlowchart(diagram) {
48
+ if (diagram.nodes.filter((n) => n.parent === -1).length !== 1)
49
+ return null;
50
+ const nodes = diagram.nodes.map((n, i) => node(`t${i}`, n.description ? `${n.label} — ${n.description}` : n.label, n.highlighted ? 'FFF2CC' : undefined));
51
+ const edges = diagram.nodes.flatMap((n, i) => (n.parent >= 0 ? [edge(`t${n.parent}`, `t${i}`)] : []));
52
+ return { direction: 'TD', nodes, edges, subgraphs: [] };
53
+ }
54
+ /** The tree generators for a flowchart-shaped tree, or `null` below 2 nodes or past `MAX_TREE_DEPTH`. */
55
+ export function treeSmartArt(flowchart, options) {
56
+ if (!flowchart || flowchart.nodes.length < 2)
57
+ return null;
58
+ const depth = flowchartTreeDepth(flowchart);
59
+ if (depth < 2 || depth > MAX_TREE_DEPTH)
60
+ return null;
61
+ return { layout: 'tree', ...(depth > 2 ? generateDeepTree(flowchart, options) : generateTree(flowchart, options)) };
62
+ }
63
+ /**
64
+ * SmartArt parts for a parsed `mindmap`, or `null` when it is empty or not representable (a single
65
+ * node, more than `MAX_TREE_DEPTH` levels): the caller then keeps the shape-built mindmap.
66
+ */
67
+ export function generateMindmapSmartArt(chart, options = {}) {
68
+ return treeSmartArt(mindmapToFlowchart(chart), options);
69
+ }
70
+ /** SmartArt parts for a parsed `treeView-beta`, or `null` (several top-level entries, too deep…). */
71
+ export function generateTreeViewSmartArt(diagram, options = {}) {
72
+ return treeSmartArt(treeViewToFlowchart(diagram), options);
73
+ }
74
+ //# sourceMappingURL=from-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from-tree.js","sourceRoot":"","sources":["../../src/smartart/from-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,SAAS,IAAI,CAAC,EAAU,EAAE,KAAa,EAAE,IAAa;IACpD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACpG,CAAC;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,EAAU;IACpC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAClE,CAAC;AAED,iFAAiF;A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M,UAAU,wBAAwB,CAAC,OAAwB,EAAE,UAAmC,EAAE;IACtG,OAAO,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { SmartArtStyle } from './styles.js';
2
+ /** Options shared by the SmartArt generators. */
3
+ export interface SmartArtGenerateOptions {
4
+ /**
5
+ * Also produce the pre-rendered `dsp:drawing` part (and reference it from the data model through
6
+ * `dgm:extLst`). Off by default: the caller must then add the part and replace the relationship
7
+ * placeholder (`DRAWING_REL_TOKEN`) — the Pandoc bridge and the CLI do.
8
+ */
9
+ drawing?: boolean;
10
+ /** Look profile (default `simple`, the original flat single-accent look). See `styles.ts`. */
11
+ style?: SmartArtStyle;
12
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generate-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-options.js","sourceRoot":"","sources":["../../src/smartart/generate-options.ts"],"names":[],"mappings":""}