postext 1.69.0 → 1.70.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 (599) hide show
  1. package/README.md +2 -1
  2. package/dist/__tests__/exports.test.js +3 -0
  3. package/dist/__tests__/exports.test.js.map +1 -1
  4. package/dist/composed/sourceMap/text.d.ts.map +1 -1
  5. package/dist/composed/sourceMap/text.js +1 -15
  6. package/dist/composed/sourceMap/text.js.map +1 -1
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/paint/displayList/blocks.d.ts +29 -0
  12. package/dist/paint/displayList/blocks.d.ts.map +1 -0
  13. package/dist/paint/displayList/blocks.js +257 -0
  14. package/dist/paint/displayList/blocks.js.map +1 -0
  15. package/dist/paint/displayList/comic.d.ts +8 -0
  16. package/dist/paint/displayList/comic.d.ts.map +1 -0
  17. package/dist/paint/displayList/comic.js +142 -0
  18. package/dist/paint/displayList/comic.js.map +1 -0
  19. package/dist/paint/displayList/design.d.ts +27 -0
  20. package/dist/paint/displayList/design.d.ts.map +1 -0
  21. package/dist/paint/displayList/design.js +190 -0
  22. package/dist/paint/displayList/design.js.map +1 -0
  23. package/dist/paint/displayList/displayList.test.d.ts +2 -0
  24. package/dist/paint/displayList/displayList.test.d.ts.map +1 -0
  25. package/dist/paint/displayList/displayList.test.js +256 -0
  26. package/dist/paint/displayList/displayList.test.js.map +1 -0
  27. package/dist/paint/displayList/eastAsian.test.d.ts +2 -0
  28. package/dist/paint/displayList/eastAsian.test.d.ts.map +1 -0
  29. package/dist/paint/displayList/eastAsian.test.js +112 -0
  30. package/dist/paint/displayList/eastAsian.test.js.map +1 -0
  31. package/dist/paint/displayList/frame.d.ts +49 -0
  32. package/dist/paint/displayList/frame.d.ts.map +1 -0
  33. package/dist/paint/displayList/frame.js +230 -0
  34. package/dist/paint/displayList/frame.js.map +1 -0
  35. package/dist/paint/displayList/frames.test.d.ts +2 -0
  36. package/dist/paint/displayList/frames.test.d.ts.map +1 -0
  37. package/dist/paint/displayList/frames.test.js +129 -0
  38. package/dist/paint/displayList/frames.test.js.map +1 -0
  39. package/dist/paint/displayList/index.d.ts +4 -0
  40. package/dist/paint/displayList/index.d.ts.map +1 -0
  41. package/dist/paint/displayList/index.js +5 -0
  42. package/dist/paint/displayList/index.js.map +1 -0
  43. package/dist/paint/displayList/inline.d.ts +19 -0
  44. package/dist/paint/displayList/inline.d.ts.map +1 -0
  45. package/dist/paint/displayList/inline.js +84 -0
  46. package/dist/paint/displayList/inline.js.map +1 -0
  47. package/dist/paint/displayList/lines.d.ts +60 -0
  48. package/dist/paint/displayList/lines.d.ts.map +1 -0
  49. package/dist/paint/displayList/lines.js +267 -0
  50. package/dist/paint/displayList/lines.js.map +1 -0
  51. package/dist/paint/displayList/overlays.d.ts +23 -0
  52. package/dist/paint/displayList/overlays.d.ts.map +1 -0
  53. package/dist/paint/displayList/overlays.js +99 -0
  54. package/dist/paint/displayList/overlays.js.map +1 -0
  55. package/dist/paint/displayList/overlays.test.d.ts +2 -0
  56. package/dist/paint/displayList/overlays.test.d.ts.map +1 -0
  57. package/dist/paint/displayList/overlays.test.js +241 -0
  58. package/dist/paint/displayList/overlays.test.js.map +1 -0
  59. package/dist/paint/displayList/page.d.ts +8 -0
  60. package/dist/paint/displayList/page.d.ts.map +1 -0
  61. package/dist/paint/displayList/page.js +157 -0
  62. package/dist/paint/displayList/page.js.map +1 -0
  63. package/dist/paint/displayList/resource.d.ts +6 -0
  64. package/dist/paint/displayList/resource.d.ts.map +1 -0
  65. package/dist/paint/displayList/resource.js +195 -0
  66. package/dist/paint/displayList/resource.js.map +1 -0
  67. package/dist/paint/displayList/review.test.d.ts +2 -0
  68. package/dist/paint/displayList/review.test.d.ts.map +1 -0
  69. package/dist/paint/displayList/review.test.js +185 -0
  70. package/dist/paint/displayList/review.test.js.map +1 -0
  71. package/dist/paint/displayList/source.d.ts +57 -0
  72. package/dist/paint/displayList/source.d.ts.map +1 -0
  73. package/dist/paint/displayList/source.js +263 -0
  74. package/dist/paint/displayList/source.js.map +1 -0
  75. package/dist/paint/displayList/source.test.d.ts +2 -0
  76. package/dist/paint/displayList/source.test.d.ts.map +1 -0
  77. package/dist/paint/displayList/source.test.js +37 -0
  78. package/dist/paint/displayList/source.test.js.map +1 -0
  79. package/dist/paint/displayList/types.d.ts +309 -0
  80. package/dist/paint/displayList/types.d.ts.map +1 -0
  81. package/dist/paint/displayList/types.js +7 -0
  82. package/dist/paint/displayList/types.js.map +1 -0
  83. package/dist/paint/segmentPlainLength.d.ts +9 -0
  84. package/dist/paint/segmentPlainLength.d.ts.map +1 -0
  85. package/dist/paint/segmentPlainLength.js +19 -0
  86. package/dist/paint/segmentPlainLength.js.map +1 -0
  87. package/dist/parse/sourceMapping.d.ts.map +1 -1
  88. package/dist/parse/sourceMapping.js +10 -4
  89. package/dist/parse/sourceMapping.js.map +1 -1
  90. package/dist/word/anchors/anchors.test.d.ts +2 -0
  91. package/dist/word/anchors/anchors.test.d.ts.map +1 -0
  92. package/dist/word/anchors/anchors.test.js +88 -0
  93. package/dist/word/anchors/anchors.test.js.map +1 -0
  94. package/dist/word/anchors/base64.d.ts +3 -0
  95. package/dist/word/anchors/base64.d.ts.map +1 -0
  96. package/dist/word/anchors/base64.js +47 -0
  97. package/dist/word/anchors/base64.js.map +1 -0
  98. package/dist/word/anchors/bookmarks.d.ts +11 -0
  99. package/dist/word/anchors/bookmarks.d.ts.map +1 -0
  100. package/dist/word/anchors/bookmarks.js +34 -0
  101. package/dist/word/anchors/bookmarks.js.map +1 -0
  102. package/dist/word/anchors/exportMap.d.ts +25 -0
  103. package/dist/word/anchors/exportMap.d.ts.map +1 -0
  104. package/dist/word/anchors/exportMap.js +131 -0
  105. package/dist/word/anchors/exportMap.js.map +1 -0
  106. package/dist/word/anchors/hash.d.ts +7 -0
  107. package/dist/word/anchors/hash.d.ts.map +1 -0
  108. package/dist/word/anchors/hash.js +39 -0
  109. package/dist/word/anchors/hash.js.map +1 -0
  110. package/dist/word/anchors/index.d.ts +7 -0
  111. package/dist/word/anchors/index.d.ts.map +1 -0
  112. package/dist/word/anchors/index.js +9 -0
  113. package/dist/word/anchors/index.js.map +1 -0
  114. package/dist/word/anchors/ommlHash.d.ts +8 -0
  115. package/dist/word/anchors/ommlHash.d.ts.map +1 -0
  116. package/dist/word/anchors/ommlHash.js +71 -0
  117. package/dist/word/anchors/ommlHash.js.map +1 -0
  118. package/dist/word/anchors/types.d.ts +87 -0
  119. package/dist/word/anchors/types.d.ts.map +1 -0
  120. package/dist/word/anchors/types.js +8 -0
  121. package/dist/word/anchors/types.js.map +1 -0
  122. package/dist/word/fonts/cmap.d.ts +13 -0
  123. package/dist/word/fonts/cmap.d.ts.map +1 -0
  124. package/dist/word/fonts/cmap.js +235 -0
  125. package/dist/word/fonts/cmap.js.map +1 -0
  126. package/dist/word/fonts/fonts.test.d.ts +2 -0
  127. package/dist/word/fonts/fonts.test.d.ts.map +1 -0
  128. package/dist/word/fonts/fonts.test.js +459 -0
  129. package/dist/word/fonts/fonts.test.js.map +1 -0
  130. package/dist/word/fonts/glyf.d.ts +21 -0
  131. package/dist/word/fonts/glyf.d.ts.map +1 -0
  132. package/dist/word/fonts/glyf.js +139 -0
  133. package/dist/word/fonts/glyf.js.map +1 -0
  134. package/dist/word/fonts/gsub.d.ts +8 -0
  135. package/dist/word/fonts/gsub.d.ts.map +1 -0
  136. package/dist/word/fonts/gsub.js +145 -0
  137. package/dist/word/fonts/gsub.js.map +1 -0
  138. package/dist/word/fonts/gsub.test.d.ts +2 -0
  139. package/dist/word/fonts/gsub.test.d.ts.map +1 -0
  140. package/dist/word/fonts/gsub.test.js +98 -0
  141. package/dist/word/fonts/gsub.test.js.map +1 -0
  142. package/dist/word/fonts/index.d.ts +6 -0
  143. package/dist/word/fonts/index.d.ts.map +1 -0
  144. package/dist/word/fonts/index.js +5 -0
  145. package/dist/word/fonts/index.js.map +1 -0
  146. package/dist/word/fonts/merge.d.ts +7 -0
  147. package/dist/word/fonts/merge.d.ts.map +1 -0
  148. package/dist/word/fonts/merge.js +222 -0
  149. package/dist/word/fonts/merge.js.map +1 -0
  150. package/dist/word/fonts/meta.d.ts +33 -0
  151. package/dist/word/fonts/meta.d.ts.map +1 -0
  152. package/dist/word/fonts/meta.js +206 -0
  153. package/dist/word/fonts/meta.js.map +1 -0
  154. package/dist/word/fonts/plan.d.ts +31 -0
  155. package/dist/word/fonts/plan.d.ts.map +1 -0
  156. package/dist/word/fonts/plan.js +275 -0
  157. package/dist/word/fonts/plan.js.map +1 -0
  158. package/dist/word/fonts/sfnt.d.ts +47 -0
  159. package/dist/word/fonts/sfnt.d.ts.map +1 -0
  160. package/dist/word/fonts/sfnt.js +202 -0
  161. package/dist/word/fonts/sfnt.js.map +1 -0
  162. package/dist/word/fonts/types.d.ts +54 -0
  163. package/dist/word/fonts/types.d.ts.map +1 -0
  164. package/dist/word/fonts/types.js +5 -0
  165. package/dist/word/fonts/types.js.map +1 -0
  166. package/dist/word/formatted/displayRoundTrip.test.d.ts +2 -0
  167. package/dist/word/formatted/displayRoundTrip.test.d.ts.map +1 -0
  168. package/dist/word/formatted/displayRoundTrip.test.js +99 -0
  169. package/dist/word/formatted/displayRoundTrip.test.js.map +1 -0
  170. package/dist/word/formatted/drawing.d.ts +61 -0
  171. package/dist/word/formatted/drawing.d.ts.map +1 -0
  172. package/dist/word/formatted/drawing.js +85 -0
  173. package/dist/word/formatted/drawing.js.map +1 -0
  174. package/dist/word/formatted/dump.test.d.ts +2 -0
  175. package/dist/word/formatted/dump.test.d.ts.map +1 -0
  176. package/dist/word/formatted/dump.test.js +31 -0
  177. package/dist/word/formatted/dump.test.js.map +1 -0
  178. package/dist/word/formatted/eastAsian.d.ts +68 -0
  179. package/dist/word/formatted/eastAsian.d.ts.map +1 -0
  180. package/dist/word/formatted/eastAsian.js +144 -0
  181. package/dist/word/formatted/eastAsian.js.map +1 -0
  182. package/dist/word/formatted/formatted.test-helper.d.ts +34 -0
  183. package/dist/word/formatted/formatted.test-helper.d.ts.map +1 -0
  184. package/dist/word/formatted/formatted.test-helper.js +138 -0
  185. package/dist/word/formatted/formatted.test-helper.js.map +1 -0
  186. package/dist/word/formatted/formatted.test.d.ts +2 -0
  187. package/dist/word/formatted/formatted.test.d.ts.map +1 -0
  188. package/dist/word/formatted/formatted.test.js +285 -0
  189. package/dist/word/formatted/formatted.test.js.map +1 -0
  190. package/dist/word/formatted/fragments.d.ts +30 -0
  191. package/dist/word/formatted/fragments.d.ts.map +1 -0
  192. package/dist/word/formatted/fragments.js +98 -0
  193. package/dist/word/formatted/fragments.js.map +1 -0
  194. package/dist/word/formatted/graphics.test.d.ts +2 -0
  195. package/dist/word/formatted/graphics.test.d.ts.map +1 -0
  196. package/dist/word/formatted/graphics.test.js +204 -0
  197. package/dist/word/formatted/graphics.test.js.map +1 -0
  198. package/dist/word/formatted/index.d.ts +8 -0
  199. package/dist/word/formatted/index.d.ts.map +1 -0
  200. package/dist/word/formatted/index.js +103 -0
  201. package/dist/word/formatted/index.js.map +1 -0
  202. package/dist/word/formatted/inline.test.d.ts +2 -0
  203. package/dist/word/formatted/inline.test.d.ts.map +1 -0
  204. package/dist/word/formatted/inline.test.js +154 -0
  205. package/dist/word/formatted/inline.test.js.map +1 -0
  206. package/dist/word/formatted/inlineShapes.d.ts +13 -0
  207. package/dist/word/formatted/inlineShapes.d.ts.map +1 -0
  208. package/dist/word/formatted/inlineShapes.js +79 -0
  209. package/dist/word/formatted/inlineShapes.js.map +1 -0
  210. package/dist/word/formatted/metrics.d.ts +54 -0
  211. package/dist/word/formatted/metrics.d.ts.map +1 -0
  212. package/dist/word/formatted/metrics.js +165 -0
  213. package/dist/word/formatted/metrics.js.map +1 -0
  214. package/dist/word/formatted/page.d.ts +16 -0
  215. package/dist/word/formatted/page.d.ts.map +1 -0
  216. package/dist/word/formatted/page.js +82 -0
  217. package/dist/word/formatted/page.js.map +1 -0
  218. package/dist/word/formatted/paragraphs.d.ts +98 -0
  219. package/dist/word/formatted/paragraphs.d.ts.map +1 -0
  220. package/dist/word/formatted/paragraphs.js +364 -0
  221. package/dist/word/formatted/paragraphs.js.map +1 -0
  222. package/dist/word/formatted/pictures.d.ts +27 -0
  223. package/dist/word/formatted/pictures.d.ts.map +1 -0
  224. package/dist/word/formatted/pictures.js +239 -0
  225. package/dist/word/formatted/pictures.js.map +1 -0
  226. package/dist/word/formatted/review.test.d.ts +2 -0
  227. package/dist/word/formatted/review.test.d.ts.map +1 -0
  228. package/dist/word/formatted/review.test.js +141 -0
  229. package/dist/word/formatted/review.test.js.map +1 -0
  230. package/dist/word/formatted/runs.d.ts +135 -0
  231. package/dist/word/formatted/runs.d.ts.map +1 -0
  232. package/dist/word/formatted/runs.js +433 -0
  233. package/dist/word/formatted/runs.js.map +1 -0
  234. package/dist/word/formatted/scripts.test.d.ts +2 -0
  235. package/dist/word/formatted/scripts.test.d.ts.map +1 -0
  236. package/dist/word/formatted/scripts.test.js +201 -0
  237. package/dist/word/formatted/scripts.test.js.map +1 -0
  238. package/dist/word/formatted/shapes.d.ts +29 -0
  239. package/dist/word/formatted/shapes.d.ts.map +1 -0
  240. package/dist/word/formatted/shapes.js +101 -0
  241. package/dist/word/formatted/shapes.js.map +1 -0
  242. package/dist/word/formatted/styles.d.ts +17 -0
  243. package/dist/word/formatted/styles.d.ts.map +1 -0
  244. package/dist/word/formatted/styles.js +91 -0
  245. package/dist/word/formatted/styles.js.map +1 -0
  246. package/dist/word/formatted/tables.d.ts +13 -0
  247. package/dist/word/formatted/tables.d.ts.map +1 -0
  248. package/dist/word/formatted/tables.js +159 -0
  249. package/dist/word/formatted/tables.js.map +1 -0
  250. package/dist/word/formatted/text.d.ts +32 -0
  251. package/dist/word/formatted/text.d.ts.map +1 -0
  252. package/dist/word/formatted/text.js +115 -0
  253. package/dist/word/formatted/text.js.map +1 -0
  254. package/dist/word/formatted/types.d.ts +68 -0
  255. package/dist/word/formatted/types.d.ts.map +1 -0
  256. package/dist/word/formatted/types.js +4 -0
  257. package/dist/word/formatted/types.js.map +1 -0
  258. package/dist/word/formatted/units.d.ts +23 -0
  259. package/dist/word/formatted/units.d.ts.map +1 -0
  260. package/dist/word/formatted/units.js +51 -0
  261. package/dist/word/formatted/units.js.map +1 -0
  262. package/dist/word/formatted/widths.test.d.ts +2 -0
  263. package/dist/word/formatted/widths.test.d.ts.map +1 -0
  264. package/dist/word/formatted/widths.test.js +327 -0
  265. package/dist/word/formatted/widths.test.js.map +1 -0
  266. package/dist/word/index.d.ts +13 -2
  267. package/dist/word/index.d.ts.map +1 -1
  268. package/dist/word/index.js +14 -5
  269. package/dist/word/index.js.map +1 -1
  270. package/dist/word/integration/corpus.known.test.d.ts +2 -0
  271. package/dist/word/integration/corpus.known.test.d.ts.map +1 -0
  272. package/dist/word/integration/corpus.known.test.js +42 -0
  273. package/dist/word/integration/corpus.known.test.js.map +1 -0
  274. package/dist/word/integration/corpus.test.d.ts +2 -0
  275. package/dist/word/integration/corpus.test.d.ts.map +1 -0
  276. package/dist/word/integration/corpus.test.js +352 -0
  277. package/dist/word/integration/corpus.test.js.map +1 -0
  278. package/dist/word/integration/formatted.test.d.ts +2 -0
  279. package/dist/word/integration/formatted.test.d.ts.map +1 -0
  280. package/dist/word/integration/formatted.test.js +125 -0
  281. package/dist/word/integration/formatted.test.js.map +1 -0
  282. package/dist/word/integration/integration.test-helper.d.ts +16 -0
  283. package/dist/word/integration/integration.test-helper.d.ts.map +1 -0
  284. package/dist/word/integration/integration.test-helper.js +48 -0
  285. package/dist/word/integration/integration.test-helper.js.map +1 -0
  286. package/dist/word/integration/sample.test-helper.d.ts +5 -0
  287. package/dist/word/integration/sample.test-helper.d.ts.map +1 -0
  288. package/dist/word/integration/sample.test-helper.js +48 -0
  289. package/dist/word/integration/sample.test-helper.js.map +1 -0
  290. package/dist/word/integration/semantic.test.d.ts +2 -0
  291. package/dist/word/integration/semantic.test.d.ts.map +1 -0
  292. package/dist/word/integration/semantic.test.js +111 -0
  293. package/dist/word/integration/semantic.test.js.map +1 -0
  294. package/dist/word/integration/wordEdit.test-helper.d.ts +14 -0
  295. package/dist/word/integration/wordEdit.test-helper.d.ts.map +1 -0
  296. package/dist/word/integration/wordEdit.test-helper.js +150 -0
  297. package/dist/word/integration/wordEdit.test-helper.js.map +1 -0
  298. package/dist/word/omml.d.ts.map +1 -1
  299. package/dist/word/omml.js +17 -5
  300. package/dist/word/omml.js.map +1 -1
  301. package/dist/word/omml.test.d.ts +2 -0
  302. package/dist/word/omml.test.d.ts.map +1 -0
  303. package/dist/word/omml.test.js +46 -0
  304. package/dist/word/omml.test.js.map +1 -0
  305. package/dist/word/ommlWrite/convert.d.ts +20 -0
  306. package/dist/word/ommlWrite/convert.d.ts.map +1 -0
  307. package/dist/word/ommlWrite/convert.js +311 -0
  308. package/dist/word/ommlWrite/convert.js.map +1 -0
  309. package/dist/word/ommlWrite/index.d.ts +25 -0
  310. package/dist/word/ommlWrite/index.d.ts.map +1 -0
  311. package/dist/word/ommlWrite/index.js +80 -0
  312. package/dist/word/ommlWrite/index.js.map +1 -0
  313. package/dist/word/ommlWrite/mml.d.ts +49 -0
  314. package/dist/word/ommlWrite/mml.d.ts.map +1 -0
  315. package/dist/word/ommlWrite/mml.js +73 -0
  316. package/dist/word/ommlWrite/mml.js.map +1 -0
  317. package/dist/word/ommlWrite/ommlWrite.test.d.ts +2 -0
  318. package/dist/word/ommlWrite/ommlWrite.test.d.ts.map +1 -0
  319. package/dist/word/ommlWrite/ommlWrite.test.js +230 -0
  320. package/dist/word/ommlWrite/ommlWrite.test.js.map +1 -0
  321. package/dist/word/ommlWrite/rows.d.ts +6 -0
  322. package/dist/word/ommlWrite/rows.d.ts.map +1 -0
  323. package/dist/word/ommlWrite/rows.js +216 -0
  324. package/dist/word/ommlWrite/rows.js.map +1 -0
  325. package/dist/word/ommlWrite/runs.d.ts +30 -0
  326. package/dist/word/ommlWrite/runs.d.ts.map +1 -0
  327. package/dist/word/ommlWrite/runs.js +122 -0
  328. package/dist/word/ommlWrite/runs.js.map +1 -0
  329. package/dist/word/ommlWrite/tables.d.ts +4 -0
  330. package/dist/word/ommlWrite/tables.d.ts.map +1 -0
  331. package/dist/word/ommlWrite/tables.js +50 -0
  332. package/dist/word/ommlWrite/tables.js.map +1 -0
  333. package/dist/word/ooxml/constants.d.ts +54 -0
  334. package/dist/word/ooxml/constants.d.ts.map +1 -0
  335. package/dist/word/ooxml/constants.js +85 -0
  336. package/dist/word/ooxml/constants.js.map +1 -0
  337. package/dist/word/ooxml/fonts.d.ts +16 -0
  338. package/dist/word/ooxml/fonts.d.ts.map +1 -0
  339. package/dist/word/ooxml/fonts.js +71 -0
  340. package/dist/word/ooxml/fonts.js.map +1 -0
  341. package/dist/word/ooxml/index.d.ts +7 -0
  342. package/dist/word/ooxml/index.d.ts.map +1 -0
  343. package/dist/word/ooxml/index.js +7 -0
  344. package/dist/word/ooxml/index.js.map +1 -0
  345. package/dist/word/ooxml/package.d.ts +21 -0
  346. package/dist/word/ooxml/package.d.ts.map +1 -0
  347. package/dist/word/ooxml/package.js +202 -0
  348. package/dist/word/ooxml/package.js.map +1 -0
  349. package/dist/word/ooxml/package.test.d.ts +2 -0
  350. package/dist/word/ooxml/package.test.d.ts.map +1 -0
  351. package/dist/word/ooxml/package.test.js +176 -0
  352. package/dist/word/ooxml/package.test.js.map +1 -0
  353. package/dist/word/ooxml/parts.d.ts +28 -0
  354. package/dist/word/ooxml/parts.d.ts.map +1 -0
  355. package/dist/word/ooxml/parts.js +172 -0
  356. package/dist/word/ooxml/parts.js.map +1 -0
  357. package/dist/word/ooxml/review.test.d.ts +2 -0
  358. package/dist/word/ooxml/review.test.d.ts.map +1 -0
  359. package/dist/word/ooxml/review.test.js +104 -0
  360. package/dist/word/ooxml/review.test.js.map +1 -0
  361. package/dist/word/ooxml/types.d.ts +85 -0
  362. package/dist/word/ooxml/types.d.ts.map +1 -0
  363. package/dist/word/ooxml/types.js +6 -0
  364. package/dist/word/ooxml/types.js.map +1 -0
  365. package/dist/word/ooxml/validate.d.ts +3 -0
  366. package/dist/word/ooxml/validate.d.ts.map +1 -0
  367. package/dist/word/ooxml/validate.js +122 -0
  368. package/dist/word/ooxml/validate.js.map +1 -0
  369. package/dist/word/ooxml/wellFormed.d.ts +3 -0
  370. package/dist/word/ooxml/wellFormed.d.ts.map +1 -0
  371. package/dist/word/ooxml/wellFormed.js +79 -0
  372. package/dist/word/ooxml/wellFormed.js.map +1 -0
  373. package/dist/word/roundtrip/added.d.ts +31 -0
  374. package/dist/word/roundtrip/added.d.ts.map +1 -0
  375. package/dist/word/roundtrip/added.js +199 -0
  376. package/dist/word/roundtrip/added.js.map +1 -0
  377. package/dist/word/roundtrip/added.test.d.ts +2 -0
  378. package/dist/word/roundtrip/added.test.d.ts.map +1 -0
  379. package/dist/word/roundtrip/added.test.js +59 -0
  380. package/dist/word/roundtrip/added.test.js.map +1 -0
  381. package/dist/word/roundtrip/apply.d.ts +11 -0
  382. package/dist/word/roundtrip/apply.d.ts.map +1 -0
  383. package/dist/word/roundtrip/apply.js +260 -0
  384. package/dist/word/roundtrip/apply.js.map +1 -0
  385. package/dist/word/roundtrip/blocks.d.ts +56 -0
  386. package/dist/word/roundtrip/blocks.d.ts.map +1 -0
  387. package/dist/word/roundtrip/blocks.js +145 -0
  388. package/dist/word/roundtrip/blocks.js.map +1 -0
  389. package/dist/word/roundtrip/corpus.test.d.ts +2 -0
  390. package/dist/word/roundtrip/corpus.test.d.ts.map +1 -0
  391. package/dist/word/roundtrip/corpus.test.js +54 -0
  392. package/dist/word/roundtrip/corpus.test.js.map +1 -0
  393. package/dist/word/roundtrip/diff.d.ts +15 -0
  394. package/dist/word/roundtrip/diff.d.ts.map +1 -0
  395. package/dist/word/roundtrip/diff.js +160 -0
  396. package/dist/word/roundtrip/diff.js.map +1 -0
  397. package/dist/word/roundtrip/diff.test.d.ts +2 -0
  398. package/dist/word/roundtrip/diff.test.d.ts.map +1 -0
  399. package/dist/word/roundtrip/diff.test.js +79 -0
  400. package/dist/word/roundtrip/diff.test.js.map +1 -0
  401. package/dist/word/roundtrip/edits.d.ts +34 -0
  402. package/dist/word/roundtrip/edits.d.ts.map +1 -0
  403. package/dist/word/roundtrip/edits.js +467 -0
  404. package/dist/word/roundtrip/edits.js.map +1 -0
  405. package/dist/word/roundtrip/fixture.test-helper.d.ts +62 -0
  406. package/dist/word/roundtrip/fixture.test-helper.d.ts.map +1 -0
  407. package/dist/word/roundtrip/fixture.test-helper.js +258 -0
  408. package/dist/word/roundtrip/fixture.test-helper.js.map +1 -0
  409. package/dist/word/roundtrip/formats.d.ts +6 -0
  410. package/dist/word/roundtrip/formats.d.ts.map +1 -0
  411. package/dist/word/roundtrip/formats.js +102 -0
  412. package/dist/word/roundtrip/formats.js.map +1 -0
  413. package/dist/word/roundtrip/formatted.test.d.ts +2 -0
  414. package/dist/word/roundtrip/formatted.test.d.ts.map +1 -0
  415. package/dist/word/roundtrip/formatted.test.js +93 -0
  416. package/dist/word/roundtrip/formatted.test.js.map +1 -0
  417. package/dist/word/roundtrip/holders.test.d.ts +2 -0
  418. package/dist/word/roundtrip/holders.test.d.ts.map +1 -0
  419. package/dist/word/roundtrip/holders.test.js +109 -0
  420. package/dist/word/roundtrip/holders.test.js.map +1 -0
  421. package/dist/word/roundtrip/index.d.ts +6 -0
  422. package/dist/word/roundtrip/index.d.ts.map +1 -0
  423. package/dist/word/roundtrip/index.js +9 -0
  424. package/dist/word/roundtrip/index.js.map +1 -0
  425. package/dist/word/roundtrip/markup.d.ts +35 -0
  426. package/dist/word/roundtrip/markup.d.ts.map +1 -0
  427. package/dist/word/roundtrip/markup.js +168 -0
  428. package/dist/word/roundtrip/markup.js.map +1 -0
  429. package/dist/word/roundtrip/math.d.ts +12 -0
  430. package/dist/word/roundtrip/math.d.ts.map +1 -0
  431. package/dist/word/roundtrip/math.js +47 -0
  432. package/dist/word/roundtrip/math.js.map +1 -0
  433. package/dist/word/roundtrip/math.test.d.ts +2 -0
  434. package/dist/word/roundtrip/math.test.d.ts.map +1 -0
  435. package/dist/word/roundtrip/math.test.js +63 -0
  436. package/dist/word/roundtrip/math.test.js.map +1 -0
  437. package/dist/word/roundtrip/merge.d.ts +21 -0
  438. package/dist/word/roundtrip/merge.d.ts.map +1 -0
  439. package/dist/word/roundtrip/merge.js +81 -0
  440. package/dist/word/roundtrip/merge.js.map +1 -0
  441. package/dist/word/roundtrip/paragraphs.test.d.ts +2 -0
  442. package/dist/word/roundtrip/paragraphs.test.d.ts.map +1 -0
  443. package/dist/word/roundtrip/paragraphs.test.js +44 -0
  444. package/dist/word/roundtrip/paragraphs.test.js.map +1 -0
  445. package/dist/word/roundtrip/read.d.ts +60 -0
  446. package/dist/word/roundtrip/read.d.ts.map +1 -0
  447. package/dist/word/roundtrip/read.js +247 -0
  448. package/dist/word/roundtrip/read.js.map +1 -0
  449. package/dist/word/roundtrip/review.test.d.ts +2 -0
  450. package/dist/word/roundtrip/review.test.d.ts.map +1 -0
  451. package/dist/word/roundtrip/review.test.js +76 -0
  452. package/dist/word/roundtrip/review.test.js.map +1 -0
  453. package/dist/word/roundtrip/semantic.test.d.ts +2 -0
  454. package/dist/word/roundtrip/semantic.test.d.ts.map +1 -0
  455. package/dist/word/roundtrip/semantic.test.js +121 -0
  456. package/dist/word/roundtrip/semantic.test.js.map +1 -0
  457. package/dist/word/roundtrip/targets.d.ts +26 -0
  458. package/dist/word/roundtrip/targets.d.ts.map +1 -0
  459. package/dist/word/roundtrip/targets.js +58 -0
  460. package/dist/word/roundtrip/targets.js.map +1 -0
  461. package/dist/word/roundtrip/types.d.ts +46 -0
  462. package/dist/word/roundtrip/types.d.ts.map +1 -0
  463. package/dist/word/roundtrip/types.js +4 -0
  464. package/dist/word/roundtrip/types.js.map +1 -0
  465. package/dist/word/roundtrip/walk.d.ts +66 -0
  466. package/dist/word/roundtrip/walk.d.ts.map +1 -0
  467. package/dist/word/roundtrip/walk.js +328 -0
  468. package/dist/word/roundtrip/walk.js.map +1 -0
  469. package/dist/word/roundtrip/writers.test.d.ts +2 -0
  470. package/dist/word/roundtrip/writers.test.d.ts.map +1 -0
  471. package/dist/word/roundtrip/writers.test.js +51 -0
  472. package/dist/word/roundtrip/writers.test.js.map +1 -0
  473. package/dist/word/semantic/atoms.d.ts +14 -0
  474. package/dist/word/semantic/atoms.d.ts.map +1 -0
  475. package/dist/word/semantic/atoms.js +85 -0
  476. package/dist/word/semantic/atoms.js.map +1 -0
  477. package/dist/word/semantic/blocks.d.ts +39 -0
  478. package/dist/word/semantic/blocks.d.ts.map +1 -0
  479. package/dist/word/semantic/blocks.js +260 -0
  480. package/dist/word/semantic/blocks.js.map +1 -0
  481. package/dist/word/semantic/chapter.d.ts +17 -0
  482. package/dist/word/semantic/chapter.d.ts.map +1 -0
  483. package/dist/word/semantic/chapter.js +56 -0
  484. package/dist/word/semantic/chapter.js.map +1 -0
  485. package/dist/word/semantic/constructs.test.d.ts +2 -0
  486. package/dist/word/semantic/constructs.test.d.ts.map +1 -0
  487. package/dist/word/semantic/constructs.test.js +267 -0
  488. package/dist/word/semantic/constructs.test.js.map +1 -0
  489. package/dist/word/semantic/containers.d.ts +8 -0
  490. package/dist/word/semantic/containers.d.ts.map +1 -0
  491. package/dist/word/semantic/containers.js +141 -0
  492. package/dist/word/semantic/containers.js.map +1 -0
  493. package/dist/word/semantic/context.d.ts +83 -0
  494. package/dist/word/semantic/context.d.ts.map +1 -0
  495. package/dist/word/semantic/context.js +9 -0
  496. package/dist/word/semantic/context.js.map +1 -0
  497. package/dist/word/semantic/corpus.test.d.ts +2 -0
  498. package/dist/word/semantic/corpus.test.d.ts.map +1 -0
  499. package/dist/word/semantic/corpus.test.js +80 -0
  500. package/dist/word/semantic/corpus.test.js.map +1 -0
  501. package/dist/word/semantic/engineNumbers.d.ts +31 -0
  502. package/dist/word/semantic/engineNumbers.d.ts.map +1 -0
  503. package/dist/word/semantic/engineNumbers.js +66 -0
  504. package/dist/word/semantic/engineNumbers.js.map +1 -0
  505. package/dist/word/semantic/figures.d.ts +8 -0
  506. package/dist/word/semantic/figures.d.ts.map +1 -0
  507. package/dist/word/semantic/figures.js +175 -0
  508. package/dist/word/semantic/figures.js.map +1 -0
  509. package/dist/word/semantic/fixtures/harness.d.ts +20 -0
  510. package/dist/word/semantic/fixtures/harness.d.ts.map +1 -0
  511. package/dist/word/semantic/fixtures/harness.js +89 -0
  512. package/dist/word/semantic/fixtures/harness.js.map +1 -0
  513. package/dist/word/semantic/fragments.d.ts +48 -0
  514. package/dist/word/semantic/fragments.d.ts.map +1 -0
  515. package/dist/word/semantic/fragments.js +109 -0
  516. package/dist/word/semantic/fragments.js.map +1 -0
  517. package/dist/word/semantic/index.d.ts +25 -0
  518. package/dist/word/semantic/index.d.ts.map +1 -0
  519. package/dist/word/semantic/index.js +141 -0
  520. package/dist/word/semantic/index.js.map +1 -0
  521. package/dist/word/semantic/inline.d.ts +34 -0
  522. package/dist/word/semantic/inline.d.ts.map +1 -0
  523. package/dist/word/semantic/inline.js +210 -0
  524. package/dist/word/semantic/inline.js.map +1 -0
  525. package/dist/word/semantic/inspect.d.ts +6 -0
  526. package/dist/word/semantic/inspect.d.ts.map +1 -0
  527. package/dist/word/semantic/inspect.js +102 -0
  528. package/dist/word/semantic/inspect.js.map +1 -0
  529. package/dist/word/semantic/marks.d.ts +30 -0
  530. package/dist/word/semantic/marks.d.ts.map +1 -0
  531. package/dist/word/semantic/marks.js +87 -0
  532. package/dist/word/semantic/marks.js.map +1 -0
  533. package/dist/word/semantic/numbering.d.ts +18 -0
  534. package/dist/word/semantic/numbering.d.ts.map +1 -0
  535. package/dist/word/semantic/numbering.js +93 -0
  536. package/dist/word/semantic/numbering.js.map +1 -0
  537. package/dist/word/semantic/numbers.test.d.ts +2 -0
  538. package/dist/word/semantic/numbers.test.d.ts.map +1 -0
  539. package/dist/word/semantic/numbers.test.js +53 -0
  540. package/dist/word/semantic/numbers.test.js.map +1 -0
  541. package/dist/word/semantic/raw.d.ts +8 -0
  542. package/dist/word/semantic/raw.d.ts.map +1 -0
  543. package/dist/word/semantic/raw.js +42 -0
  544. package/dist/word/semantic/raw.js.map +1 -0
  545. package/dist/word/semantic/review.test.d.ts +2 -0
  546. package/dist/word/semantic/review.test.d.ts.map +1 -0
  547. package/dist/word/semantic/review.test.js +88 -0
  548. package/dist/word/semantic/review.test.js.map +1 -0
  549. package/dist/word/semantic/sections.d.ts +25 -0
  550. package/dist/word/semantic/sections.d.ts.map +1 -0
  551. package/dist/word/semantic/sections.js +83 -0
  552. package/dist/word/semantic/sections.js.map +1 -0
  553. package/dist/word/semantic/snippet.d.ts +10 -0
  554. package/dist/word/semantic/snippet.d.ts.map +1 -0
  555. package/dist/word/semantic/snippet.js +34 -0
  556. package/dist/word/semantic/snippet.js.map +1 -0
  557. package/dist/word/semantic/styles.d.ts +66 -0
  558. package/dist/word/semantic/styles.d.ts.map +1 -0
  559. package/dist/word/semantic/styles.js +354 -0
  560. package/dist/word/semantic/styles.js.map +1 -0
  561. package/dist/word/semantic/tables.d.ts +4 -0
  562. package/dist/word/semantic/tables.d.ts.map +1 -0
  563. package/dist/word/semantic/tables.js +114 -0
  564. package/dist/word/semantic/tables.js.map +1 -0
  565. package/dist/word/semantic/types.d.ts +9 -0
  566. package/dist/word/semantic/types.d.ts.map +1 -0
  567. package/dist/word/semantic/types.js +3 -0
  568. package/dist/word/semantic/types.js.map +1 -0
  569. package/dist/word/semantic/wml.d.ts +104 -0
  570. package/dist/word/semantic/wml.d.ts.map +1 -0
  571. package/dist/word/semantic/wml.js +192 -0
  572. package/dist/word/semantic/wml.js.map +1 -0
  573. package/dist/word/word.test.js +31 -53
  574. package/dist/word/word.test.js.map +1 -1
  575. package/dist/word/xml.d.ts +16 -0
  576. package/dist/word/xml.d.ts.map +1 -1
  577. package/dist/word/xml.js +61 -15
  578. package/dist/word/xml.js.map +1 -1
  579. package/dist/word/xml.test.d.ts +2 -0
  580. package/dist/word/xml.test.d.ts.map +1 -0
  581. package/dist/word/xml.test.js +46 -0
  582. package/dist/word/xml.test.js.map +1 -0
  583. package/package.json +1 -1
  584. package/dist/word/toDocx/parse.d.ts +0 -46
  585. package/dist/word/toDocx/parse.d.ts.map +0 -1
  586. package/dist/word/toDocx/parse.js +0 -313
  587. package/dist/word/toDocx/parse.js.map +0 -1
  588. package/dist/word/toDocx/styles.d.ts +0 -63
  589. package/dist/word/toDocx/styles.d.ts.map +0 -1
  590. package/dist/word/toDocx/styles.js +0 -239
  591. package/dist/word/toDocx/styles.js.map +0 -1
  592. package/dist/word/toDocx/wordml.d.ts +0 -24
  593. package/dist/word/toDocx/wordml.d.ts.map +0 -1
  594. package/dist/word/toDocx/wordml.js +0 -114
  595. package/dist/word/toDocx/wordml.js.map +0 -1
  596. package/dist/word/toDocx.d.ts +0 -6
  597. package/dist/word/toDocx.d.ts.map +0 -1
  598. package/dist/word/toDocx.js +0 -157
  599. package/dist/word/toDocx.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ // Display-list content of the formatted Word export round-trips (#1406):
2
+ // chips cut into runs in their own faces, inline code, link-note QR codes,
3
+ // video frames and overlays (turned or not), chips in table cells and a
4
+ // strip's caption; an
5
+ // unedited export reads back with no edit and a valid package, and an
6
+ // edit to a strip's generated caption is reported as rejected.
7
+ import { describe, it, expect } from 'vitest';
8
+ import { validateDocxPackage } from '../ooxml/validate.js';
9
+ import { xmlProblems } from '../ooxml/wellFormed.js';
10
+ import { applyDocxEdits } from '../roundtrip/index.js';
11
+ import { editDocx } from '../roundtrip/fixture.test-helper.js';
12
+ import { typeOver } from '../integration/wordEdit.test-helper.js';
13
+ import { formattedDocx } from './index.js';
14
+ import { hasFragment, isImportable } from './fragments.js';
15
+ import { build, config, documentXml, LOREM, mm, unzip } from './formatted.test-helper.js';
16
+ const pt = (value) => ({ value, unit: 'pt' });
17
+ async function roundTrip(md, cfg, resources) {
18
+ const doc = build(md, cfg, resources);
19
+ const bytes = await formattedDocx({ docs: [doc], chapters: [{ id: 'c', markdown: md }], ...(resources ? { resources } : {}), date: '2026-11-04T00:00:00Z', exportId: 'x' });
20
+ const files = unzip(bytes);
21
+ const xml = documentXml(files);
22
+ expect(validateDocxPackage(files)).toEqual([]);
23
+ expect(xmlProblems(xml)).toEqual([]);
24
+ const r = applyDocxEdits(bytes, { chapters: [{ id: 'c', markdown: md }] });
25
+ expect(r.edits).toEqual([]);
26
+ expect(r.chapters[0].markdown).toBe(md);
27
+ return xml;
28
+ }
29
+ const video = (placement) => ({
30
+ id: 'talk', typeId: 'video', kind: 'video', caption: 'The talk.', createdAt: 0, updatedAt: 0,
31
+ video: { source: 'youtube', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' },
32
+ placement,
33
+ });
34
+ describe('display-list content round-trips through the formatted export (#1406)', () => {
35
+ it('chips in a bold style and inline code', async () => {
36
+ const cfg = config({ chipStyles: [{ id: 'k', fontFamily: 'Test Mono', bold: true, paddingX: pt(2), background: { hex: '#eeeeee', model: 'hex' } }] });
37
+ const md = `Press :chip[Enter **now**]{style=k} and run \`npm test\` before you go. ${LOREM}\n`;
38
+ const xml = await roundTrip(md, cfg);
39
+ // The style's bold is the face (a character style), not direct w:b.
40
+ const enter = xml.match(/<w:r>(<w:rPr>(?:(?!<\/w:rPr>).)*<\/w:rPr>)<w:t xml:space="preserve">Ente/);
41
+ expect(enter).not.toBeNull();
42
+ expect(enter[1]).not.toContain('<w:b/>');
43
+ // Its box, an empty text box, and the room before its words.
44
+ expect(xml).toMatch(/txBox="1"\/><wps:spPr>(?:(?!<\/wps:spPr>).)*EEEEEE/);
45
+ expect(xml).toMatch(/<w:spacing w:val="\d+"\/>(?:(?!<\/w:r>).)*<w:t xml:space="preserve"> <\/w:t><\/w:r><w:r><w:rPr>(?:(?!<\/w:rPr>).)*<\/w:rPr><w:t xml:space="preserve">Ente/);
46
+ });
47
+ it('a word retyped in a chip stays inside its brackets', async () => {
48
+ const cfg = config({ chipStyles: [{ id: 'w', paddingX: pt(2) }] });
49
+ const md = `:::paragraphs\n:chip[GOGGLES]{style="w"} :chip[TOWEL]{style="w"} :chip[BALL]{style="w"}\n:::\n`;
50
+ await roundTrip(md, cfg);
51
+ const bytes = await formattedDocx({ docs: [build(md, cfg)], chapters: [{ id: 'c', markdown: md }], date: '2026-11-04T00:00:00Z', exportId: 'x' });
52
+ const r = applyDocxEdits(editDocx(bytes, (x) => typeOver(x, 'TOWEL', 'harbour')), { chapters: [{ id: 'c', markdown: md }] });
53
+ expect(r.chapters[0].markdown).toBe(md.replace('TOWEL', 'harbour'));
54
+ });
55
+ it('a link note’s QR code', async () => {
56
+ const cfg = config({ links: { print: 'notes', show: 'both', qr: { size: mm(15) } } });
57
+ const xml = await roundTrip('You can reach [the official page](https://example.com/docs/start) for more.\n', cfg);
58
+ expect(xml).toContain('<a:custGeom>');
59
+ });
60
+ it('a video, upright and turned', async () => {
61
+ await roundTrip('Intro.\n\n::resource{id="talk"}\n', config(), [video({ position: 'here' })]);
62
+ await roundTrip('See the talk :ref{id="talk"}.\n\nMore text.\n', config(), [video({ rotate: 'ccw' })]);
63
+ });
64
+ it('a chip in a table cell', async () => {
65
+ const res = {
66
+ id: 't1', typeId: 'table', kind: 'table', caption: 'Keys.', createdAt: 0, updatedAt: 0,
67
+ table: { model: { headerRowCount: 1, rows: [[{ content: 'Key', isHeader: true }], [{ content: 'Press `Esc`' }]] } },
68
+ placement: { position: 'here' },
69
+ };
70
+ const xml = await roundTrip('Intro.\n\n::resource{id="t1"}\n', config(), [res]);
71
+ expect(xml).toContain('Esc');
72
+ });
73
+ it('a strip’s caption', async () => {
74
+ const md = 'Text.\n\n:::strip{width=60% caption="A *quiet* morning." type=figure id=daily}\n::panel\n::panel\n:::\n\nAfter.\n';
75
+ const xml = await roundTrip(md, config());
76
+ expect(xml).toMatch(/Figure(?:(?!<\/w:p>).)*quiet(?:(?!<\/w:p>).)*morning/);
77
+ });
78
+ it('reports an edit to a strip’s caption as rejected, not dropped', async () => {
79
+ const md = 'Text.\n\n:::strip{width=60% caption="A *quiet* morning." type=figure id=daily}\n::panel\n::panel\n:::\n\nAfter.\n';
80
+ const doc = build(md, config());
81
+ const bytes = await formattedDocx({ docs: [doc], chapters: [{ id: 'c', markdown: md }], date: '2026-11-04T00:00:00Z', exportId: 'x' });
82
+ const edited = editDocx(bytes, (x) => x.replace('quiet', 'loud').replace('After.', 'Later.'));
83
+ const r = applyDocxEdits(edited, { chapters: [{ id: 'c', markdown: md }] });
84
+ expect(r.chapters[0].markdown).toBe(md.replace('After.', 'Later.'));
85
+ expect(r.edits).toEqual(expect.arrayContaining([
86
+ expect.objectContaining({ status: 'rejected', reason: 'generated', before: expect.stringContaining('quiet'), after: expect.stringContaining('loud') }),
87
+ expect.objectContaining({ status: 'applied', before: 'After', after: 'Later' }),
88
+ ]));
89
+ });
90
+ it('wraps generated text in a fragment only when its edits are reported', () => {
91
+ const item = (source) => ({ kind: 'text', role: 'caption', bbox: { x: 0, y: 0, width: 1, height: 1 }, lines: [], source });
92
+ const repeated = item({ blockKey: 'r', map: [-1, -1], generated: true, reportEdits: true, resource: { resourceId: 't', field: 'caption' } });
93
+ expect(isImportable(repeated)).toBe(false);
94
+ expect(hasFragment(repeated)).toBe(true);
95
+ expect(hasFragment(item({ blockKey: 'h', map: [-1], generated: true }))).toBe(false);
96
+ expect(hasFragment(item({ blockKey: 'b', map: [0] }))).toBe(true);
97
+ });
98
+ });
99
+ //# sourceMappingURL=displayRoundTrip.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"displayRoundTrip.test.js","sourceRoot":"","sources":["../../../src/word/formatted/displayRoundTrip.test.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AACxE,sBAAsB;AACtB,sEAAsE;AACtE,+DAA+D;AAE/D,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,E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C,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QAC7I,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrF,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { DisplayRect } from '../../paint/displayList/types.js';
2
+ import type { WriterContext } from './types.js';
3
+ export interface AnchorBox {
4
+ /** Unrotated box on the page, px. */
5
+ rect: DisplayRect;
6
+ /** Degrees clockwise about the box centre. */
7
+ rotate?: number;
8
+ behind?: boolean;
9
+ name: string;
10
+ descr?: string;
11
+ }
12
+ /** The point `p` of a frame turned by `deg` clockwise about `c`. */
13
+ export declare function turnPoint(p: {
14
+ x: number;
15
+ y: number;
16
+ }, c: {
17
+ x: number;
18
+ y: number;
19
+ }, deg: number): {
20
+ x: number;
21
+ y: number;
22
+ };
23
+ /** A box laid out in an item's unturned frame (turned `deg` about the
24
+ * item's centre `c`) as Word places it: same size, centred where the
25
+ * turn carries its centre, turned about its own centre. */
26
+ export declare function turnedBox(rect: DisplayRect, c: {
27
+ x: number;
28
+ y: number;
29
+ }, deg: number | undefined): DisplayRect;
30
+ /** One `w:r` holding a page-anchored drawing around `graphic` (the
31
+ * `a:graphic` element). */
32
+ export declare function anchorRun(ctx: WriterContext, box: AnchorBox, graphic: (id: number, cx: number, cy: number) => string): string;
33
+ export declare function xfrm(cx: number, cy: number, rotate?: number, flipH?: boolean, flipV?: boolean): string;
34
+ /** Body of a shape that holds no text: an empty text box. LibreOffice
35
+ * imports plain shapes and text boxes as two kinds of frame and loses
36
+ * their `relativeHeight` order once a document holds many text boxes
37
+ * (an opener band painted over its own text); one kind keeps it (#1406).
38
+ * Its paragraph is a twip tall, so even a chip's box holds it. */
39
+ export declare const EMPTY_TXBX = "<w:p><w:pPr><w:spacing w:before=\"0\" w:after=\"0\" w:line=\"20\" w:lineRule=\"exact\"/><w:rPr><w:sz w:val=\"2\"/><w:szCs w:val=\"2\"/></w:rPr></w:pPr></w:p>";
40
+ /** A Word shape (`wps:wsp`) with its `spPr` children and its text box
41
+ * (empty when `text` is absent) and body properties. */
42
+ export declare function shapeGraphic(spPr: string, text?: {
43
+ content: string;
44
+ vert?: 'horz' | 'eaVert';
45
+ }): string;
46
+ /** A text box: no fill, no line, zero insets, no autofit. */
47
+ export declare function textBoxRun(ctx: WriterContext, box: AnchorBox, content: string, vert?: 'horz' | 'eaVert'): string;
48
+ export interface BlipRefs {
49
+ blip: string;
50
+ svg?: string;
51
+ }
52
+ /** A picture (`pic:pic`) stretched over the box, cropped by `srcRect`
53
+ * (1/1000 % of the picture per side). */
54
+ export declare function pictureGraphic(id: number, cx: number, cy: number, refs: BlipRefs, opts: {
55
+ name: string;
56
+ descr?: string;
57
+ srcRect?: string;
58
+ rotate?: number;
59
+ flipH?: boolean;
60
+ }): string;
61
+ //# sourceMappingURL=drawing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../../src/word/formatted/drawing.ts"],"names":[],"mappings":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;;;;mEAImE;AACnE,eAAO,MAAM,UAAU,kKAAsJ,CAAC;AAE9K;yDACyD;AACzD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,MAAM,CAQvG;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAIhH;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;0CAC0C;AAC1C,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAYrL"}
@@ -0,0 +1,85 @@
1
+ // DrawingML wrappers of the formatted Word export (#1392): every object
2
+ // on a page is a `wp:anchor` placed in EMU relative to the page, with no
3
+ // wrapping, locked to its anchor paragraph, stacked in paint order
4
+ // (`relativeHeight`). Text boxes, shapes and pictures go inside.
5
+ import { escapeAttr } from '../xml.js';
6
+ import { angle, emu } from './units.js';
7
+ const WPS_URI = 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape';
8
+ const PIC_URI = 'http://schemas.openxmlformats.org/drawingml/2006/picture';
9
+ /** Lowest `relativeHeight` Word itself hands out. */
10
+ const Z_BASE = 251658240;
11
+ /** The point `p` of a frame turned by `deg` clockwise about `c`. */
12
+ export function turnPoint(p, c, deg) {
13
+ if (!deg)
14
+ return p;
15
+ const r = (deg * Math.PI) / 180;
16
+ const cos = Math.cos(r);
17
+ const sin = Math.sin(r);
18
+ const dx = p.x - c.x;
19
+ const dy = p.y - c.y;
20
+ return { x: c.x + dx * cos - dy * sin, y: c.y + dx * sin + dy * cos };
21
+ }
22
+ /** A box laid out in an item's unturned frame (turned `deg` about the
23
+ * item's centre `c`) as Word places it: same size, centred where the
24
+ * turn carries its centre, turned about its own centre. */
25
+ export function turnedBox(rect, c, deg) {
26
+ if (!deg)
27
+ return rect;
28
+ const centre = turnPoint({ x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 }, c, deg);
29
+ return { x: centre.x - rect.width / 2, y: centre.y - rect.height / 2, width: rect.width, height: rect.height };
30
+ }
31
+ /** One `w:r` holding a page-anchored drawing around `graphic` (the
32
+ * `a:graphic` element). */
33
+ export function anchorRun(ctx, box, graphic) {
34
+ const id = ctx.pkg.nextDrawingId();
35
+ const cx = Math.max(0, emu(box.rect.width, ctx.dpi));
36
+ const cy = Math.max(0, emu(box.rect.height, ctx.dpi));
37
+ const z = Z_BASE + ++ctx.z;
38
+ const descr = box.descr ? ` descr="${escapeAttr(box.descr)}"` : '';
39
+ return ('<w:r><w:rPr><w:noProof/><w:sz w:val="2"/><w:szCs w:val="2"/></w:rPr><w:drawing>' +
40
+ `<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" relativeHeight="${z}" behindDoc="${box.behind ? 1 : 0}" locked="1" layoutInCell="1" allowOverlap="1">` +
41
+ '<wp:simplePos x="0" y="0"/>' +
42
+ `<wp:positionH relativeFrom="page"><wp:posOffset>${emu(box.rect.x, ctx.dpi)}</wp:posOffset></wp:positionH>` +
43
+ `<wp:positionV relativeFrom="page"><wp:posOffset>${emu(box.rect.y, ctx.dpi)}</wp:posOffset></wp:positionV>` +
44
+ `<wp:extent cx="${cx}" cy="${cy}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/>` +
45
+ `<wp:docPr id="${id}" name="${escapeAttr(box.name)} ${id}"${descr}/><wp:cNvGraphicFramePr/>` +
46
+ graphic(id, cx, cy) +
47
+ '</wp:anchor></w:drawing></w:r>');
48
+ }
49
+ export function xfrm(cx, cy, rotate, flipH, flipV) {
50
+ const rot = rotate ? ` rot="${angle(rotate)}"` : '';
51
+ return `<a:xfrm${rot}${flipH ? ' flipH="1"' : ''}${flipV ? ' flipV="1"' : ''}><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm>`;
52
+ }
53
+ /** Body of a shape that holds no text: an empty text box. LibreOffice
54
+ * imports plain shapes and text boxes as two kinds of frame and loses
55
+ * their `relativeHeight` order once a document holds many text boxes
56
+ * (an opener band painted over its own text); one kind keeps it (#1406).
57
+ * Its paragraph is a twip tall, so even a chip's box holds it. */
58
+ export const EMPTY_TXBX = '<w:p><w:pPr><w:spacing w:before="0" w:after="0" w:line="20" w:lineRule="exact"/><w:rPr><w:sz w:val="2"/><w:szCs w:val="2"/></w:rPr></w:pPr></w:p>';
59
+ /** A Word shape (`wps:wsp`) with its `spPr` children and its text box
60
+ * (empty when `text` is absent) and body properties. */
61
+ export function shapeGraphic(spPr, text) {
62
+ return (`<a:graphic><a:graphicData uri="${WPS_URI}"><wps:wsp>` +
63
+ `<wps:cNvSpPr txBox="1"/><wps:spPr>${spPr}</wps:spPr>` +
64
+ `<wps:txbx><w:txbxContent>${text?.content ?? EMPTY_TXBX}</w:txbxContent></wps:txbx>` +
65
+ `<wps:bodyPr rot="0" vert="${text?.vert ?? 'horz'}" wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" anchor="t" anchorCtr="0" upright="0"><a:noAutofit/></wps:bodyPr>` +
66
+ '</wps:wsp></a:graphicData></a:graphic>');
67
+ }
68
+ /** A text box: no fill, no line, zero insets, no autofit. */
69
+ export function textBoxRun(ctx, box, content, vert) {
70
+ return anchorRun(ctx, box, (_id, cx, cy) => shapeGraphic(`${xfrm(cx, cy, box.rotate)}<a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/><a:ln><a:noFill/></a:ln>`, { content, ...(vert ? { vert } : {}) }));
71
+ }
72
+ /** A picture (`pic:pic`) stretched over the box, cropped by `srcRect`
73
+ * (1/1000 % of the picture per side). */
74
+ export function pictureGraphic(id, cx, cy, refs, opts) {
75
+ const ext = refs.svg
76
+ ? `<a:extLst><a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}"><asvg:svgBlip r:embed="${refs.svg}"/></a:ext></a:extLst>`
77
+ : '';
78
+ const descr = opts.descr ? ` descr="${escapeAttr(opts.descr)}"` : '';
79
+ return (`<a:graphic><a:graphicData uri="${PIC_URI}"><pic:pic>` +
80
+ `<pic:nvPicPr><pic:cNvPr id="${id}" name="${escapeAttr(opts.name)}"${descr}/><pic:cNvPicPr><a:picLocks noChangeAspect="1"/></pic:cNvPicPr></pic:nvPicPr>` +
81
+ `<pic:blipFill><a:blip r:embed="${refs.blip}">${ext}</a:blip>${opts.srcRect ?? ''}<a:stretch><a:fillRect/></a:stretch></pic:blipFill>` +
82
+ `<pic:spPr>${xfrm(cx, cy, opts.rotate, opts.flipH)}<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr>` +
83
+ '</pic:pic></a:graphicData></a:graphic>');
84
+ }
85
+ //# sourceMappingURL=drawing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawing.js","sourceRoot":"","sources":["../../../src/word/formatted/drawing.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yEAAyE;AACzE,mEAAmE;AACnE,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAIxC,MAAM,OAAO,GAAG,mEAAmE,CAAC;AACpF,MAAM,OAAO,GAAG,0DAA0D,CAAC;AAC3E,qD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,CAAC;AAOD;0CAC0C;AAC1C,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,IAAc,EAAE,IAA0F;IAC3K,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG;QAClB,CAAC,CAAC,wFAAwF,IAAI,CAAC,GAAG,wBAAwB;QAC1H,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACrE,OAAO,CACL,kCAAkC,OAAO,aAAa;QACtD,+BAA+B,EAAE,WAAW,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,+EAA+E;QACzJ,kCAAkC,IAAI,CAAC,IAAI,KAAK,GAAG,YAAY,IAAI,CAAC,OAAO,IAAI,EAAE,qDAAqD;QACtI,aAAa,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,4DAA4D;QAC9G,wCAAwC,CACzC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dump.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dump.test.d.ts","sourceRoot":"","sources":["../../../src/word/formatted/dump.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ // Writes one sample formatted .docx for visual checks in Word or
2
+ // LibreOffice: `DOCX_DUMP=1 npx vitest run src/word/formatted/dump.test.ts`
3
+ // (DOCX_DUMP_PATH=<file>, default ./formatted-sample.docx). Skipped otherwise.
4
+ import { describe, it, expect } from 'vitest';
5
+ import { formattedDocx } from './index.js';
6
+ import { build, config, LOREM } from './formatted.test-helper.js';
7
+ const env = globalThis.process?.env ?? {};
8
+ const DEFAULT_PATH = 'formatted-sample.docx';
9
+ describe.skipIf(env.DOCX_DUMP !== '1')('formatted sample dump', () => {
10
+ it('writes the sample', async () => {
11
+ const cell = (content, extra = {}) => ({ content, ...extra });
12
+ const resources = [
13
+ { id: 'f1', typeId: 'figure', kind: 'bitmap', caption: 'A *small* plate of type.', altText: 'Type', createdAt: 0, updatedAt: 0, bitmap: { fileId: 'f1.png', format: 'png', width: 300, height: 200 } },
14
+ { id: 't1', typeId: 'table', kind: 'table', caption: 'Services and benefits.', createdAt: 0, updatedAt: 0, table: { model: { headerRowCount: 1, rows: [[cell('Item', { isHeader: true }), cell('Grade', { isHeader: true })], [cell('First'), cell('Yes')], [cell('Second'), cell('No')]] } } },
15
+ ];
16
+ const md = `# The sample\n\nA paragraph with **bold**, *italic* and a note[^a]. See :ref{id="f1"} and :ref{id="t1"}.\n\n${LOREM}\n\n${LOREM}\n\n${LOREM}\n\n[^a]: The note says something.\n`;
17
+ const doc = build(md, config({ layout: { layoutType: 'double' } }), resources);
18
+ const png = Uint8Array.from(atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=='), (c) => c.charCodeAt(0));
19
+ const bytes = await formattedDocx({ docs: [doc], chapters: [{ id: 'sample', markdown: md }], resources, resourceBytes: () => png, date: '2026-11-04T00:00:00Z' });
20
+ // Node only (the test is skipped elsewhere); untyped so the package
21
+ // needs no Node types.
22
+ const mod = 'node:fs';
23
+ const fs = (await import(/* @vite-ignore */ mod));
24
+ const path = env.DOCX_DUMP_PATH ?? DEFAULT_PATH;
25
+ if (path.includes('/'))
26
+ fs.mkdirSync(path.slice(0, path.lastIndexOf('/')), { recursive: true });
27
+ fs.writeFileSync(path, bytes);
28
+ expect(bytes.length).toBeGreaterThan(1000);
29
+ });
30
+ });
31
+ //# sourceMappingURL=dump.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dump.test.js","sourceRoot":"","sources":["../../../src/word/formatted/dump.test.ts"],"names":[],"mappings":"AAA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AAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChG,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { DisplayLine, DisplayRect, DisplayRun } from '../../paint/displayList/types.js';
2
+ import type { WriterContext } from './types.js';
3
+ /** A run's text cut into the pieces a vertical line sets: `tcy` pieces
4
+ * stand in one upright cell. */
5
+ export interface VerticalPiece {
6
+ text: string;
7
+ tcy: boolean;
8
+ }
9
+ /** The pieces of a run on a vertical line: the whole run when it is a
10
+ * tate-chu-yoko cell, else the cells the measurer found (`verticalRuns`:
11
+ * short numbers, Japanese !? pairs), each Latin character of an
12
+ * `:upright[…]` run a cell of its own. */
13
+ export declare function verticalPieces(ctx: WriterContext, run: DisplayRun, text: string): VerticalPiece[];
14
+ /** `w:eastAsianLayout` of a tate-chu-yoko cell or a two-lines-in-one
15
+ * note, with an id of its own (Word joins adjacent runs that share one). */
16
+ export declare function eastAsianLayout(ctx: WriterContext, kind: 'vert' | 'combine'): string;
17
+ /** A `w:r` of plain text. */
18
+ export declare function textRun(rPr: string, text: string): string;
19
+ /** A reading's advance in ems, as Word sets it: wide characters one em,
20
+ * the rest about half an em (no face is measured here). */
21
+ export declare function readingEms(text: string): number;
22
+ /** The size (half-points) and `rtPr` that set a reading of `ems` in
23
+ * `widthPx` along the line, when at `szHalfPoints` it would run longer:
24
+ * Word has no overhang and widens the base to its reading, lengthening
25
+ * the line the engine set (#1406). The size goes down: LibreOffice
26
+ * ignores a reading's character scale and spacing. */
27
+ export declare function condensedReading(ctx: WriterContext, rtPr: string, ems: number, szHalfPoints: number, widthPx: number): {
28
+ rtPr: string;
29
+ sz: number;
30
+ } | undefined;
31
+ /** A ruby base and its reading as one `w:ruby`. `rPr` is the base's
32
+ * properties, `rtPr` the reading's; the sizes are half-points. A reading
33
+ * longer than the base is set smaller, to the base's width (`line`: the
34
+ * whole jukugo word at one size). */
35
+ export declare function rubyXml(ctx: WriterContext, run: DisplayRun, text: string, rPr: string, rtPr: string, sizes: {
36
+ base: number;
37
+ rt: number;
38
+ }, line?: DisplayLine): string;
39
+ /** Text drawn beside a run (a kanbun mark), in the item's unturned
40
+ * frame: `x` where it starts along the line, `baseline` its baseline. */
41
+ export interface Annotation {
42
+ text: string;
43
+ fontString: string;
44
+ color: string;
45
+ x: number;
46
+ baseline: number;
47
+ vertical: boolean;
48
+ }
49
+ /** The kanbun marks of a run as annotations, and its 竪点 as a rule
50
+ * (from, to along the line, at `y`, `thickness` across). */
51
+ export declare function kuntenOf(run: DisplayRun, line: DisplayLine): {
52
+ annotations: Annotation[];
53
+ rules: {
54
+ x1: number;
55
+ x2: number;
56
+ y: number;
57
+ thickness: number;
58
+ color: string;
59
+ }[];
60
+ };
61
+ /** The box of an annotation in the item's unturned frame: one em a
62
+ * character along the line, across it from the ascent (horizontal) or
63
+ * centred on the baseline (vertical: a central baseline). */
64
+ export declare function annotationRect(a: Annotation): DisplayRect;
65
+ /** One small text box holding `xml` (a paragraph's runs) at `rect` on the
66
+ * sheet, line pitch the font's 1.2 em. */
67
+ export declare function smallTextBox(ctx: WriterContext, rect: DisplayRect, runsXml: string, sizePx: number, rotate: number | undefined, vert: 'horz' | 'eaVert'): string;
68
+ //# sourceMappingURL=eastAsian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eastAsian.d.ts","sourceRoot":"","sources":["../../../src/word/formatted/eastAsian.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAqB,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAOhH,OAAO,KAAK,EAAE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,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;6DAC6D;AAC7D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG;IAAE,WAAW,EAAE,UAAU,EAAE,CAAC;IAAC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAO5K;AAED;;8DAE8D;AAC9D,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,GAAG,WAAW,CAMzD;AAED;2CAC2C;AAC3C,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAMhK"}
@@ -0,0 +1,144 @@
1
+ // East Asian setting of the formatted Word export (#1394): ruby as
2
+ // `w:ruby`, tate-chu-yoko (`:tcy`, short numbers `cjk.uprightDigits`
3
+ // sets upright, Japanese mark pairs, `:upright` Latin) as
4
+ // `w:eastAsianLayout w:vert`, a warichu note as Word's "two lines in one"
5
+ // (`w:combine`), and the kanbun marks as small positioned text boxes.
6
+ // Vertical text boxes are `eaVert`: Word sets CJK upright and Latin
7
+ // sideways down the line itself, as the engine does.
8
+ import { graphemesOf } from '../../measure/graphemes.js';
9
+ import { verticalOrientation, verticalRuns } from '../../writing/writingMode.js';
10
+ import { escapeAttr, escapeXml } from '../xml.js';
11
+ import { textBoxRun } from './drawing.js';
12
+ import { fontSizePx } from './metrics.js';
13
+ import { halfPoints, twips } from './units.js';
14
+ /** The pieces of a run on a vertical line: the whole run when it is a
15
+ * tate-chu-yoko cell, else the cells the measurer found (`verticalRuns`:
16
+ * short numbers, Japanese !? pairs), each Latin character of an
17
+ * `:upright[…]` run a cell of its own. */
18
+ export function verticalPieces(ctx, run, text) {
19
+ if (run.tcy)
20
+ return [{ text, tcy: true }];
21
+ const region = ctx.cjk?.region ?? 'japan';
22
+ const graphemes = graphemesOf(text);
23
+ const out = [];
24
+ const push = (t, tcy) => {
25
+ const last = out[out.length - 1];
26
+ if (last && !last.tcy && !tcy)
27
+ last.text += t;
28
+ else
29
+ out.push({ text: t, tcy });
30
+ };
31
+ if (run.orientation === 'upright') {
32
+ for (const g of graphemes)
33
+ push(g, verticalOrientation(g, region).orient === 'sideways' && !/^\s+$/.test(g));
34
+ return out;
35
+ }
36
+ if (run.orientation === 'sideways')
37
+ return [{ text, tcy: false }];
38
+ for (const r of verticalRuns(graphemes, region, ctx.cjk?.uprightDigits ?? 0))
39
+ push(r.text, r.glyph.orient === 'tcy');
40
+ return out;
41
+ }
42
+ /** `w:eastAsianLayout` of a tate-chu-yoko cell or a two-lines-in-one
43
+ * note, with an id of its own (Word joins adjacent runs that share one). */
44
+ export function eastAsianLayout(ctx, kind) {
45
+ const id = (ctx.eaId = (ctx.eaId ?? 0) + 1);
46
+ return kind === 'vert'
47
+ ? `<w:eastAsianLayout w:id="${id}" w:vert="1" w:vertCompress="1"/>`
48
+ : `<w:eastAsianLayout w:id="${id}" w:combine="1"/>`;
49
+ }
50
+ /** A `w:r` of plain text. */
51
+ export function textRun(rPr, text) {
52
+ return text ? `<w:r>${rPr}<w:t xml:space="preserve">${escapeXml(text)}</w:t></w:r>` : '';
53
+ }
54
+ /** Characters set one em wide: CJK ideographs and symbols, kana,
55
+ * hangul, bopomofo, full-width forms. */
56
+ const WIDE = /^[\u1100-\u115f\u2e80-\u303e\u3041-\u33ff\u3400-\u4dbf\u4e00-\u9fff\ua960-\ua97f\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f\uff00-\uff60\uffe0-\uffe6]|^[\u{20000}-\u{3fffd}]/u;
57
+ /** A reading's advance in ems, as Word sets it: wide characters one em,
58
+ * the rest about half an em (no face is measured here). */
59
+ export function readingEms(text) {
60
+ let ems = 0;
61
+ for (const g of graphemesOf(text))
62
+ ems += /^\s+$/.test(g) ? 0.25 : WIDE.test(g) ? 1 : 0.5;
63
+ return ems;
64
+ }
65
+ /** The size (half-points) and `rtPr` that set a reading of `ems` in
66
+ * `widthPx` along the line, when at `szHalfPoints` it would run longer:
67
+ * Word has no overhang and widens the base to its reading, lengthening
68
+ * the line the engine set (#1406). The size goes down: LibreOffice
69
+ * ignores a reading's character scale and spacing. */
70
+ export function condensedReading(ctx, rtPr, ems, szHalfPoints, widthPx) {
71
+ const scale = Number(/<w:w w:val="(\d+)"\/>/.exec(rtPr)?.[1] ?? 100) / 100;
72
+ const advance = ems * ((szHalfPoints * ctx.dpi) / 144) * scale;
73
+ if (!(widthPx > 0) || advance <= widthPx + 0.01)
74
+ return undefined;
75
+ const sz = Math.max(2, Math.floor((szHalfPoints * widthPx) / advance));
76
+ return { rtPr: rtPr.replace(/<w:sz w:val="\d+"\/>/, `<w:sz w:val="${sz}"/>`).replace(/<w:szCs w:val="\d+"\/>/, `<w:szCs w:val="${sz}"/>`), sz };
77
+ }
78
+ /** The reading size (half-points) of a ruby that runs over its base, the
79
+ * smallest any run of its word takes: a jukugo word (runs of the line
80
+ * sharing the ruby's id) keeps one reading size, each reading within its
81
+ * own base, since Word widens a base to its reading. */
82
+ function rubyFit(ctx, run, rtPr, rt, line) {
83
+ const id = run.ruby.id;
84
+ const word = id !== undefined && line ? line.runs.filter((r) => r.ruby?.id === id) : [run];
85
+ let fit;
86
+ for (const r of word.length ? word : [run]) {
87
+ const c = condensedReading(ctx, rtPr, readingEms(r.ruby.text), rt, r.width);
88
+ if (c && (!fit || c.sz < fit.sz))
89
+ fit = c;
90
+ }
91
+ return fit;
92
+ }
93
+ /** A ruby base and its reading as one `w:ruby`. `rPr` is the base's
94
+ * properties, `rtPr` the reading's; the sizes are half-points. A reading
95
+ * longer than the base is set smaller, to the base's width (`line`: the
96
+ * whole jukugo word at one size). */
97
+ export function rubyXml(ctx, run, text, rPr, rtPr, sizes, line) {
98
+ const ruby = run.ruby;
99
+ if (ruby.position === 'under')
100
+ ctx.warn('ruby-under', 'a ruby set under its base is set over it in Word (Word has no ruby under the text)');
101
+ if (ruby.position === 'right')
102
+ ctx.warn('ruby-right', 'zhuyin set beside the characters is set over them in Word');
103
+ const raise = ruby.raise !== undefined ? Math.max(0, Math.round(halfPoints(Math.abs(ruby.raise), ctx.dpi))) : sizes.base;
104
+ const align = ruby.group ? 'distributeSpace' : 'center';
105
+ const lid = escapeAttr(ctx.lang ?? 'ja-JP');
106
+ const condensed = rubyFit(ctx, run, rtPr, sizes.rt, line);
107
+ if (condensed)
108
+ ctx.warn('ruby-overhang', `the reading "${ruby.text}" (or another of its word) runs over its base, which Word does not allow: it is set smaller to fit the base`);
109
+ return (`<w:r>${rPr}<w:ruby>` +
110
+ `<w:rubyPr><w:rubyAlign w:val="${align}"/><w:hps w:val="${condensed?.sz ?? sizes.rt}"/><w:hpsRaise w:val="${raise}"/><w:hpsBaseText w:val="${sizes.base}"/><w:lid w:val="${lid}"/></w:rubyPr>` +
111
+ `<w:rt>${textRun(condensed?.rtPr ?? rtPr, ruby.text)}</w:rt>` +
112
+ `<w:rubyBase>${textRun(rPr, text)}</w:rubyBase>` +
113
+ '</w:ruby></w:r>');
114
+ }
115
+ /** The kanbun marks of a run as annotations, and its 竪点 as a rule
116
+ * (from, to along the line, at `y`, `thickness` across). */
117
+ export function kuntenOf(run, line) {
118
+ const k = run.kunten;
119
+ if (!k)
120
+ return { annotations: [], rules: [] };
121
+ const color = k.color ?? run.color;
122
+ const ann = (a) => ({ text: a.text, fontString: a.fontString, color: a.color ?? color, x: run.x + a.dx, baseline: line.baseline + a.dy, vertical: line.vertical === true });
123
+ const rules = k.tate ? [{ x1: run.x + k.tate.dx, x2: run.x + k.tate.dx + k.tate.length, y: line.baseline + k.tate.dy, thickness: k.tate.thickness, color }] : [];
124
+ return { annotations: k.runs.filter((r) => r.text.length > 0).map(ann), rules };
125
+ }
126
+ /** The box of an annotation in the item's unturned frame: one em a
127
+ * character along the line, across it from the ascent (horizontal) or
128
+ * centred on the baseline (vertical: a central baseline). */
129
+ export function annotationRect(a) {
130
+ const size = fontSizePx(a.fontString) || 8;
131
+ const length = size * Math.max(1, graphemesOf(a.text).length);
132
+ return a.vertical
133
+ ? { x: a.x, y: a.baseline - size * 0.6, width: length, height: size * 1.2 }
134
+ : { x: a.x, y: a.baseline - size * 0.88, width: length, height: size * 1.2 };
135
+ }
136
+ /** One small text box holding `xml` (a paragraph's runs) at `rect` on the
137
+ * sheet, line pitch the font's 1.2 em. */
138
+ export function smallTextBox(ctx, rect, runsXml, sizePx, rotate, vert) {
139
+ const pitch = Math.max(20, twips(sizePx * 1.2, ctx.dpi));
140
+ const p = '<w:p><w:pPr><w:pStyle w:val="PostextLabel"/><w:suppressAutoHyphens/><w:kinsoku w:val="0"/><w:autoSpaceDE w:val="0"/><w:autoSpaceDN w:val="0"/><w:snapToGrid w:val="0"/>' +
141
+ `<w:spacing w:before="0" w:after="0" w:line="${pitch}" w:lineRule="exact"/><w:ind w:left="0" w:right="0" w:firstLine="0"/><w:jc w:val="left"/></w:pPr>${runsXml}</w:p>`;
142
+ return textBoxRun(ctx, { rect, name: 'ptx mark', ...(rotate ? { rotate } : {}) }, p, vert);
143
+ }
144
+ //# sourceMappingURL=eastAsian.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eastAsian.js","sourceRoot":"","sources":["../../../src/word/formatted/eastAsian.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qEAAqE;AACrE,0DAA0D;AAC1D,0EAA0E;AAC1E,sEAAsE;AACtE,oEAAoE;AACpE,qDAAqD;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OA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AI,GAAG,GAAG,EAAE;QAC3E,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,GAAG,EAAE,CAAC;AACjF,CAAC;AAED;2CAC2C;AAC3C,MAAM,UAAU,YAAY,CAAC,GAAkB,EAAE,IAAiB,EAAE,OAAe,EAAE,MAAc,EAAE,MAA0B,EAAE,IAAuB;IACtJ,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,MAAM,CAAC,GACL,yKAAyK;QACzK,+CAA+C,KAAK,oGAAoG,OAAO,QAAQ,CAAC;IAC1K,OAAO,UAAU,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { PostextConfig, Resource, VDTDocument } from '../../index.js';
2
+ import { type XmlElement } from '../xml.js';
3
+ export declare const mm: (value: number) => {
4
+ value: number;
5
+ unit: "mm";
6
+ };
7
+ export declare const LOREM = "Typesetting is the composition of text by means of arranging physical type or its digital equivalents. Stored letters and other symbols are retrieved and ordered according to the language orthography for visual display. Characteristically a justified column of text is set with even spaces between words, and long compound words such as internationalization and representativeness get hyphenated at the end of lines.";
8
+ export declare function config(over?: Partial<PostextConfig>): PostextConfig;
9
+ export declare function build(markdown: string, cfg: PostextConfig, resources?: Resource[]): VDTDocument;
10
+ export declare function unzip(bytes: Uint8Array): Record<string, Uint8Array>;
11
+ export declare function documentXml(files: Record<string, Uint8Array>): string;
12
+ export declare function els(root: XmlElement, local: string, out?: XmlElement[]): XmlElement[];
13
+ export declare const kids: (el: XmlElement) => XmlElement[];
14
+ /** Text of paragraphs as the importer reads them: `w:t`, `w:br` → '\n',
15
+ * paragraphs joined by '\n'. */
16
+ export declare function paragraphsText(paras: XmlElement[]): string;
17
+ /** Per page (anchor paragraph): the text of each text box, in order. */
18
+ export declare function pageBoxTexts(docXml: string): string[][];
19
+ /** Text inside each `_ptx_` bookmark, in document order: `w:t`, `w:br`
20
+ * → '\n', and '\n' for a paragraph that starts while it runs on. A
21
+ * ruby's reading (`w:rt`) is skipped: only its base is the text. */
22
+ export declare function bookmarkTexts(docXml: string): Map<string, string>;
23
+ /** Child local names of `el`, in order. */
24
+ export declare const childNames: (el: XmlElement) => string[];
25
+ /** True when `names` follow the order of `schema` (unknown names fail). */
26
+ export declare function inSchemaOrder(names: string[], schema: readonly string[]): boolean;
27
+ export declare const PPR_ORDER: readonly ["pStyle", "keepNext", "keepLines", "pageBreakBefore", "framePr", "widowControl", "numPr", "suppressLineNumbers", "pBdr", "shd", "tabs", "suppressAutoHyphens", "kinsoku", "wordWrap", "overflowPunct", "topLinePunct", "autoSpaceDE", "autoSpaceDN", "bidi", "adjustRightInd", "snapToGrid", "spacing", "ind", "contextualSpacing", "mirrorIndents", "suppressOverlap", "jc", "textDirection", "textAlignment", "textboxTightWrap", "outlineLvl", "divId", "cnfStyle", "rPr", "sectPr", "pPrChange"];
28
+ export declare const RPR_ORDER: readonly ["rStyle", "rFonts", "b", "bCs", "i", "iCs", "caps", "smallCaps", "strike", "dstrike", "outline", "shadow", "emboss", "imprint", "noProof", "snapToGrid", "vanish", "webHidden", "color", "spacing", "w", "kern", "position", "sz", "szCs", "highlight", "u", "effect", "bdr", "shd", "fitText", "vertAlign", "rtl", "cs", "em", "lang", "eastAsianLayout", "specVanish", "oMath", "ligatures", "numForm", "numSpacing"];
29
+ export declare const SECTPR_ORDER: readonly ["headerReference", "footerReference", "footnotePr", "endnotePr", "type", "pgSz", "pgMar", "paperSrc", "pgBorders", "lnNumType", "pgNumType", "cols", "formProt", "vAlign", "noEndnote", "titlePg", "textDirection", "bidi", "rtlGutter", "docGrid"];
30
+ export declare const ANCHOR_ORDER: readonly ["simplePos", "positionH", "positionV", "extent", "effectExtent", "wrapNone", "docPr", "cNvGraphicFramePr", "graphic"];
31
+ export declare const WSP_ORDER: readonly ["cNvPr", "cNvSpPr", "spPr", "style", "txbx", "bodyPr"];
32
+ export declare const TCPR_ORDER: readonly ["cnfStyle", "tcW", "gridSpan", "hMerge", "vMerge", "tcBorders", "shd", "noWrap", "tcMar", "textDirection", "tcFitText", "vAlign", "hideMark"];
33
+ export declare const TBLPR_ORDER: readonly ["tblStyle", "tblpPr", "tblOverlap", "bidiVisual", "tblStyleRowBandSize", "tblStyleColBandSize", "tblW", "jc", "tblCellSpacing", "tblInd", "tblBorders", "shd", "tblLayout", "tblCellMar", "tblLook"];
34
+ //# sourceMappingURL=formatted.test-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatted.test-helper.d.ts","sourceRoot":"","sources":["../../../src/word/formatted/formatted.test-helper.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAY,KAAK,UAAU,EAAa,MAAM,WAAW,CAAC;AAgBjE,eAAO,MAAM,EAAE,GAAI,OAAO,MAAM;;;CAAqC,CAAC;AAEtE,eAAO,MAAM,KAAK,qaAAqa,CAAC;AAExb,wBAAgB,MAAM,CAAC,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,aAAa,CAUvE;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,CAE/F;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,C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