@syncfusion/ej2-docx 0.0.0-stage → 35.1.40

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 (417) hide show
  1. package/.gitleaksignore +35 -0
  2. package/README.md +68 -2
  3. package/core.js +4 -0
  4. package/dist/ej2-docx.umd.min.js +11 -0
  5. package/dist/ej2-docx.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-docx.es2015.js +66697 -0
  7. package/dist/es6/ej2-docx.es2015.js.map +1 -0
  8. package/dist/es6/ej2-docx.es5.js +77568 -0
  9. package/dist/es6/ej2-docx.es5.js.map +1 -0
  10. package/dist/global/ej2-docx.min.js +11 -0
  11. package/dist/global/ej2-docx.min.js.map +1 -0
  12. package/dist/global/index.d.ts +14 -0
  13. package/features.js +4 -0
  14. package/index.js +4 -0
  15. package/license +10 -0
  16. package/package.json +30 -3
  17. package/src/all.d.ts +50 -0
  18. package/src/all.js +147 -0
  19. package/src/core/compat/base64.d.ts +13 -0
  20. package/src/core/compat/base64.js +90 -0
  21. package/src/core/compat/object-compat.d.ts +30 -0
  22. package/src/core/compat/object-compat.js +40 -0
  23. package/src/core/compat/sha256.d.ts +9 -0
  24. package/src/core/compat/sha256.js +98 -0
  25. package/src/core/errors/docx-error.d.ts +89 -0
  26. package/src/core/errors/docx-error.js +138 -0
  27. package/src/core/errors/error-codes.d.ts +8 -0
  28. package/src/core/errors/error-codes.js +0 -0
  29. package/src/core/errors/index.d.ts +10 -0
  30. package/src/core/errors/index.js +9 -0
  31. package/src/core/index.d.ts +12 -0
  32. package/src/core/index.js +12 -0
  33. package/src/core/mc/alternate-content.d.ts +7 -0
  34. package/src/core/mc/alternate-content.js +67 -0
  35. package/src/core/mc/attributes.d.ts +24 -0
  36. package/src/core/mc/attributes.js +82 -0
  37. package/src/core/mc/index.d.ts +7 -0
  38. package/src/core/mc/index.js +5 -0
  39. package/src/core/mc/inspect.d.ts +16 -0
  40. package/src/core/mc/inspect.js +148 -0
  41. package/src/core/mc/namespaces.d.ts +4 -0
  42. package/src/core/mc/namespaces.js +4 -0
  43. package/src/core/mc/scope.d.ts +6 -0
  44. package/src/core/mc/scope.js +47 -0
  45. package/src/core/opc/content-types.d.ts +34 -0
  46. package/src/core/opc/content-types.js +162 -0
  47. package/src/core/opc/index.d.ts +8 -0
  48. package/src/core/opc/index.js +4 -0
  49. package/src/core/opc/package.d.ts +49 -0
  50. package/src/core/opc/package.js +324 -0
  51. package/src/core/opc/part-name.d.ts +47 -0
  52. package/src/core/opc/part-name.js +205 -0
  53. package/src/core/opc/relationships.d.ts +46 -0
  54. package/src/core/opc/relationships.js +212 -0
  55. package/src/core/preservation/index.d.ts +2 -0
  56. package/src/core/preservation/index.js +1 -0
  57. package/src/core/preservation/opaque-body.d.ts +16 -0
  58. package/src/core/preservation/opaque-body.js +69 -0
  59. package/src/core/registry/block-handlers.d.ts +30 -0
  60. package/src/core/registry/block-handlers.js +36 -0
  61. package/src/core/registry/create-defaults.d.ts +39 -0
  62. package/src/core/registry/create-defaults.js +42 -0
  63. package/src/core/registry/feature-registry.d.ts +20 -0
  64. package/src/core/registry/feature-registry.js +29 -0
  65. package/src/core/registry/index.d.ts +9 -0
  66. package/src/core/registry/index.js +8 -0
  67. package/src/core/registry/inline-handlers.d.ts +20 -0
  68. package/src/core/registry/inline-handlers.js +30 -0
  69. package/src/core/registry/materialize-handlers.d.ts +35 -0
  70. package/src/core/registry/materialize-handlers.js +75 -0
  71. package/src/core/registry/multi-part-handlers.d.ts +37 -0
  72. package/src/core/registry/multi-part-handlers.js +206 -0
  73. package/src/core/registry/package-part-handlers.d.ts +28 -0
  74. package/src/core/registry/package-part-handlers.js +190 -0
  75. package/src/core/registry/part-handlers.d.ts +24 -0
  76. package/src/core/registry/part-handlers.js +172 -0
  77. package/src/core/registry/run-leaf-handlers.d.ts +26 -0
  78. package/src/core/registry/run-leaf-handlers.js +72 -0
  79. package/src/core/security/limits.d.ts +40 -0
  80. package/src/core/security/limits.js +26 -0
  81. package/src/core/xml/index.d.ts +7 -0
  82. package/src/core/xml/index.js +3 -0
  83. package/src/core/xml/model.d.ts +66 -0
  84. package/src/core/xml/model.js +17 -0
  85. package/src/core/xml/parse.d.ts +12 -0
  86. package/src/core/xml/parse.js +382 -0
  87. package/src/core/xml/serialize.d.ts +6 -0
  88. package/src/core/xml/serialize.js +93 -0
  89. package/src/core/zip/crc32.d.ts +2 -0
  90. package/src/core/zip/crc32.js +25 -0
  91. package/src/core/zip/deflate.d.ts +6 -0
  92. package/src/core/zip/deflate.js +6 -0
  93. package/src/core/zip/index.d.ts +10 -0
  94. package/src/core/zip/index.js +4 -0
  95. package/src/core/zip/inflate-raw.d.ts +17 -0
  96. package/src/core/zip/inflate-raw.js +450 -0
  97. package/src/core/zip/names.d.ts +6 -0
  98. package/src/core/zip/names.js +52 -0
  99. package/src/core/zip/read.d.ts +8 -0
  100. package/src/core/zip/read.js +262 -0
  101. package/src/core/zip/write.d.ts +7 -0
  102. package/src/core/zip/write.js +189 -0
  103. package/src/core/zip/zip-entry.d.ts +4 -0
  104. package/src/core/zip/zip-entry.js +0 -0
  105. package/src/features/bibliography/index.d.ts +100 -0
  106. package/src/features/bibliography/index.js +290 -0
  107. package/src/features/bookmarks/index.d.ts +331 -0
  108. package/src/features/bookmarks/index.js +1009 -0
  109. package/src/features/comments/comment-extensions.d.ts +157 -0
  110. package/src/features/comments/comment-extensions.js +356 -0
  111. package/src/features/comments/index.d.ts +579 -0
  112. package/src/features/comments/index.js +1727 -0
  113. package/src/features/content-controls/index.d.ts +821 -0
  114. package/src/features/content-controls/index.js +2857 -0
  115. package/src/features/custom-xml/index.d.ts +236 -0
  116. package/src/features/custom-xml/index.js +661 -0
  117. package/src/features/document/alignment.d.ts +23 -0
  118. package/src/features/document/alignment.js +36 -0
  119. package/src/features/document/alt-chunk.d.ts +103 -0
  120. package/src/features/document/alt-chunk.js +221 -0
  121. package/src/features/document/assert-never.d.ts +1 -0
  122. package/src/features/document/assert-never.js +4 -0
  123. package/src/features/document/augmentations.d.ts +578 -0
  124. package/src/features/document/augmentations.js +0 -0
  125. package/src/features/document/body-always-on.d.ts +36 -0
  126. package/src/features/document/body-always-on.js +66 -0
  127. package/src/features/document/body-blocks.d.ts +7 -0
  128. package/src/features/document/body-blocks.js +78 -0
  129. package/src/features/document/body-item-adapters.d.ts +62 -0
  130. package/src/features/document/body-item-adapters.js +97 -0
  131. package/src/features/document/body-item-collection.d.ts +151 -0
  132. package/src/features/document/body-item-collection.js +440 -0
  133. package/src/features/document/body-item.d.ts +35 -0
  134. package/src/features/document/body-item.js +8 -0
  135. package/src/features/document/body.d.ts +150 -0
  136. package/src/features/document/body.js +263 -0
  137. package/src/features/document/character-format.d.ts +413 -0
  138. package/src/features/document/character-format.js +2054 -0
  139. package/src/features/document/color.d.ts +178 -0
  140. package/src/features/document/color.js +495 -0
  141. package/src/features/document/document.d.ts +410 -0
  142. package/src/features/document/document.js +1049 -0
  143. package/src/features/document/element-type.d.ts +68 -0
  144. package/src/features/document/element-type.js +133 -0
  145. package/src/features/document/entity-type.d.ts +92 -0
  146. package/src/features/document/entity-type.js +93 -0
  147. package/src/features/document/feature-block.d.ts +16 -0
  148. package/src/features/document/feature-block.js +0 -0
  149. package/src/features/document/feature-inline.d.ts +13 -0
  150. package/src/features/document/feature-inline.js +0 -0
  151. package/src/features/document/feature-multi-package-part.d.ts +19 -0
  152. package/src/features/document/feature-multi-package-part.js +8 -0
  153. package/src/features/document/feature-package-level-part.d.ts +18 -0
  154. package/src/features/document/feature-package-level-part.js +8 -0
  155. package/src/features/document/feature-package-part.d.ts +14 -0
  156. package/src/features/document/feature-package-part.js +0 -0
  157. package/src/features/document/feature-run-leaf.d.ts +9 -0
  158. package/src/features/document/feature-run-leaf.js +0 -0
  159. package/src/features/document/headers-footers.d.ts +206 -0
  160. package/src/features/document/headers-footers.js +384 -0
  161. package/src/features/document/index.d.ts +41 -0
  162. package/src/features/document/index.js +34 -0
  163. package/src/features/document/length.d.ts +152 -0
  164. package/src/features/document/length.js +245 -0
  165. package/src/features/document/load-options.d.ts +14 -0
  166. package/src/features/document/load-options.js +0 -0
  167. package/src/features/document/locale-ids.d.ts +227 -0
  168. package/src/features/document/locale-ids.js +485 -0
  169. package/src/features/document/on-off.d.ts +9 -0
  170. package/src/features/document/on-off.js +27 -0
  171. package/src/features/document/page-setup.d.ts +339 -0
  172. package/src/features/document/page-setup.js +244 -0
  173. package/src/features/document/paragraph-format.d.ts +880 -0
  174. package/src/features/document/paragraph-format.js +2807 -0
  175. package/src/features/document/paragraph-item-collection.d.ts +162 -0
  176. package/src/features/document/paragraph-item-collection.js +363 -0
  177. package/src/features/document/paragraph-item.d.ts +83 -0
  178. package/src/features/document/paragraph-item.js +103 -0
  179. package/src/features/document/paragraph.d.ts +435 -0
  180. package/src/features/document/paragraph.js +888 -0
  181. package/src/features/document/run.d.ts +1 -0
  182. package/src/features/document/run.js +768 -0
  183. package/src/features/document/section-partition-flatten.d.ts +124 -0
  184. package/src/features/document/section-partition-flatten.js +217 -0
  185. package/src/features/document/section-properties-model.d.ts +13 -0
  186. package/src/features/document/section-properties-model.js +0 -0
  187. package/src/features/document/section.d.ts +93 -0
  188. package/src/features/document/section.js +178 -0
  189. package/src/features/document/sections.d.ts +103 -0
  190. package/src/features/document/sections.js +217 -0
  191. package/src/features/document/sub-super-script.d.ts +23 -0
  192. package/src/features/document/sub-super-script.js +43 -0
  193. package/src/features/document/text-range.d.ts +445 -0
  194. package/src/features/document/text-range.js +1156 -0
  195. package/src/features/document/typed-body-collections.d.ts +162 -0
  196. package/src/features/document/typed-body-collections.js +371 -0
  197. package/src/features/document/underline-style.d.ts +38 -0
  198. package/src/features/document/underline-style.js +126 -0
  199. package/src/features/document/units.d.ts +8 -0
  200. package/src/features/document/units.js +7 -0
  201. package/src/features/document/wml.d.ts +16 -0
  202. package/src/features/document/wml.js +67 -0
  203. package/src/features/drawing/authoring.d.ts +27 -0
  204. package/src/features/drawing/authoring.js +271 -0
  205. package/src/features/drawing/body-pr.d.ts +271 -0
  206. package/src/features/drawing/body-pr.js +663 -0
  207. package/src/features/drawing/drawing-shape.d.ts +1192 -0
  208. package/src/features/drawing/drawing-shape.js +3239 -0
  209. package/src/features/drawing/encode-builders.d.ts +176 -0
  210. package/src/features/drawing/encode-builders.js +390 -0
  211. package/src/features/drawing/fill-format.d.ts +52 -0
  212. package/src/features/drawing/fill-format.js +124 -0
  213. package/src/features/drawing/host-codec.d.ts +632 -0
  214. package/src/features/drawing/host-codec.js +2595 -0
  215. package/src/features/drawing/index.d.ts +13 -0
  216. package/src/features/drawing/index.js +33 -0
  217. package/src/features/drawing/line-format.d.ts +76 -0
  218. package/src/features/drawing/line-format.js +343 -0
  219. package/src/features/drawing/parse-register.d.ts +50 -0
  220. package/src/features/drawing/parse-register.js +257 -0
  221. package/src/features/drawing/residual-utils.d.ts +47 -0
  222. package/src/features/drawing/residual-utils.js +290 -0
  223. package/src/features/drawing/shape-types.d.ts +433 -0
  224. package/src/features/drawing/shape-types.js +437 -0
  225. package/src/features/drawing/sp-pr.d.ts +396 -0
  226. package/src/features/drawing/sp-pr.js +610 -0
  227. package/src/features/drawing/text-frame.d.ts +90 -0
  228. package/src/features/drawing/text-frame.js +152 -0
  229. package/src/features/drawing/types.d.ts +352 -0
  230. package/src/features/drawing/types.js +60 -0
  231. package/src/features/drawing/wrap-format.d.ts +62 -0
  232. package/src/features/drawing/wrap-format.js +114 -0
  233. package/src/features/editable-ranges/index.d.ts +494 -0
  234. package/src/features/editable-ranges/index.js +1348 -0
  235. package/src/features/fields/index.d.ts +428 -0
  236. package/src/features/fields/index.js +2148 -0
  237. package/src/features/fields/paragraph-field.d.ts +187 -0
  238. package/src/features/fields/paragraph-field.js +692 -0
  239. package/src/features/font-table/font-substitution-table.d.ts +75 -0
  240. package/src/features/font-table/font-substitution-table.js +257 -0
  241. package/src/features/font-table/font-table-entry.d.ts +255 -0
  242. package/src/features/font-table/font-table-entry.js +823 -0
  243. package/src/features/font-table/font-table.d.ts +128 -0
  244. package/src/features/font-table/font-table.js +313 -0
  245. package/src/features/font-table/index.d.ts +27 -0
  246. package/src/features/font-table/index.js +48 -0
  247. package/src/features/glossary/index.d.ts +97 -0
  248. package/src/features/glossary/index.js +286 -0
  249. package/src/features/headers-footers/index.d.ts +506 -0
  250. package/src/features/headers-footers/index.js +1666 -0
  251. package/src/features/hyperlinks/index.d.ts +230 -0
  252. package/src/features/hyperlinks/index.js +685 -0
  253. package/src/features/images/caption-authoring-api.d.ts +33 -0
  254. package/src/features/images/caption-authoring-api.js +33 -0
  255. package/src/features/images/caption-enums.d.ts +52 -0
  256. package/src/features/images/caption-enums.js +141 -0
  257. package/src/features/images/caption-host.d.ts +10 -0
  258. package/src/features/images/caption-host.js +21 -0
  259. package/src/features/images/captions.d.ts +13 -0
  260. package/src/features/images/captions.js +142 -0
  261. package/src/features/images/host-codec.d.ts +103 -0
  262. package/src/features/images/host-codec.js +720 -0
  263. package/src/features/images/image-sniff.d.ts +21 -0
  264. package/src/features/images/image-sniff.js +71 -0
  265. package/src/features/images/index.d.ts +506 -0
  266. package/src/features/images/index.js +1429 -0
  267. package/src/features/images/layout-types.d.ts +232 -0
  268. package/src/features/images/layout-types.js +294 -0
  269. package/src/features/images/public-entry.d.ts +9 -0
  270. package/src/features/images/public-entry.js +9 -0
  271. package/src/features/index.d.ts +35 -0
  272. package/src/features/index.js +36 -0
  273. package/src/features/mail-merge/index.d.ts +113 -0
  274. package/src/features/mail-merge/index.js +315 -0
  275. package/src/features/notes/index.d.ts +573 -0
  276. package/src/features/notes/index.js +1725 -0
  277. package/src/features/numbering/abstract-numbering.d.ts +90 -0
  278. package/src/features/numbering/abstract-numbering.js +292 -0
  279. package/src/features/numbering/index.d.ts +182 -0
  280. package/src/features/numbering/index.js +668 -0
  281. package/src/features/numbering/list-format.d.ts +158 -0
  282. package/src/features/numbering/list-format.js +590 -0
  283. package/src/features/numbering/list-string.d.ts +7 -0
  284. package/src/features/numbering/list-string.js +423 -0
  285. package/src/features/numbering/list-style.d.ts +204 -0
  286. package/src/features/numbering/list-style.js +1084 -0
  287. package/src/features/numbering/numbering-instance.d.ts +101 -0
  288. package/src/features/numbering/numbering-instance.js +329 -0
  289. package/src/features/numbering/numbering-level.d.ts +118 -0
  290. package/src/features/numbering/numbering-level.js +501 -0
  291. package/src/features/numbering/picture-bullet.d.ts +34 -0
  292. package/src/features/numbering/picture-bullet.js +88 -0
  293. package/src/features/ole-object/catalog.d.ts +300 -0
  294. package/src/features/ole-object/catalog.js +908 -0
  295. package/src/features/ole-object/index.d.ts +526 -0
  296. package/src/features/ole-object/index.js +1421 -0
  297. package/src/features/ole-object/relationship.d.ts +27 -0
  298. package/src/features/ole-object/relationship.js +27 -0
  299. package/src/features/ole-object/typed-dom.d.ts +186 -0
  300. package/src/features/ole-object/typed-dom.js +595 -0
  301. package/src/features/properties/index.d.ts +205 -0
  302. package/src/features/properties/index.js +549 -0
  303. package/src/features/revisions/index.d.ts +204 -0
  304. package/src/features/revisions/index.js +695 -0
  305. package/src/features/sections/column-collection.d.ts +119 -0
  306. package/src/features/sections/column-collection.js +478 -0
  307. package/src/features/sections/column.d.ts +15 -0
  308. package/src/features/sections/column.js +37 -0
  309. package/src/features/sections/index.d.ts +91 -0
  310. package/src/features/sections/index.js +1096 -0
  311. package/src/features/sections/margins.d.ts +40 -0
  312. package/src/features/sections/margins.js +105 -0
  313. package/src/features/sections/page-number-style.d.ts +21 -0
  314. package/src/features/sections/page-number-style.js +62 -0
  315. package/src/features/sections/page-orientation.d.ts +10 -0
  316. package/src/features/sections/page-orientation.js +10 -0
  317. package/src/features/sections/page-setup.d.ts +435 -0
  318. package/src/features/sections/page-setup.js +1479 -0
  319. package/src/features/sections/page-size.d.ts +59 -0
  320. package/src/features/sections/page-size.js +68 -0
  321. package/src/features/sections/section-break-code.d.ts +27 -0
  322. package/src/features/sections/section-break-code.js +60 -0
  323. package/src/features/sections/section-document-association.d.ts +18 -0
  324. package/src/features/sections/section-document-association.js +31 -0
  325. package/src/features/sections/section-validation.d.ts +43 -0
  326. package/src/features/sections/section-validation.js +97 -0
  327. package/src/features/settings/attached-template.d.ts +35 -0
  328. package/src/features/settings/attached-template.js +98 -0
  329. package/src/features/settings/compat-settings.d.ts +216 -0
  330. package/src/features/settings/compat-settings.js +508 -0
  331. package/src/features/settings/document-background.d.ts +59 -0
  332. package/src/features/settings/document-background.js +131 -0
  333. package/src/features/settings/document-protection.d.ts +65 -0
  334. package/src/features/settings/document-protection.js +157 -0
  335. package/src/features/settings/document-settings-facades.d.ts +108 -0
  336. package/src/features/settings/document-settings-facades.js +312 -0
  337. package/src/features/settings/document-settings-values.d.ts +43 -0
  338. package/src/features/settings/document-settings-values.js +60 -0
  339. package/src/features/settings/footnote-properties.d.ts +211 -0
  340. package/src/features/settings/footnote-properties.js +591 -0
  341. package/src/features/settings/index.d.ts +356 -0
  342. package/src/features/settings/index.js +829 -0
  343. package/src/features/settings/settings-children.d.ts +151 -0
  344. package/src/features/settings/settings-children.js +505 -0
  345. package/src/features/settings/web-settings.d.ts +88 -0
  346. package/src/features/settings/web-settings.js +227 -0
  347. package/src/features/settings/zoom.d.ts +79 -0
  348. package/src/features/settings/zoom.js +147 -0
  349. package/src/features/styles/builtin-catalog.d.ts +159 -0
  350. package/src/features/styles/builtin-catalog.js +963 -0
  351. package/src/features/styles/builtin-resolver.d.ts +49 -0
  352. package/src/features/styles/builtin-resolver.js +165 -0
  353. package/src/features/styles/default-styles.d.ts +37 -0
  354. package/src/features/styles/default-styles.js +186 -0
  355. package/src/features/styles/default-theme.d.ts +13 -0
  356. package/src/features/styles/default-theme.js +13 -0
  357. package/src/features/styles/doc-defaults.d.ts +58 -0
  358. package/src/features/styles/doc-defaults.js +178 -0
  359. package/src/features/styles/formatting-resolver.d.ts +27 -0
  360. package/src/features/styles/formatting-resolver.js +72 -0
  361. package/src/features/styles/index.d.ts +256 -0
  362. package/src/features/styles/index.js +1325 -0
  363. package/src/features/styles/latent-styles.d.ts +68 -0
  364. package/src/features/styles/latent-styles.js +305 -0
  365. package/src/features/styles/paragraph-properties.d.ts +71 -0
  366. package/src/features/styles/paragraph-properties.js +237 -0
  367. package/src/features/styles/run-properties.d.ts +93 -0
  368. package/src/features/styles/run-properties.js +516 -0
  369. package/src/features/styles/style-base.d.ts +402 -0
  370. package/src/features/styles/style-base.js +1026 -0
  371. package/src/features/styles/style-collection.d.ts +264 -0
  372. package/src/features/styles/style-collection.js +714 -0
  373. package/src/features/styles/style-format-bridge.d.ts +64 -0
  374. package/src/features/styles/style-format-bridge.js +100 -0
  375. package/src/features/styles/style.d.ts +84 -0
  376. package/src/features/styles/style.js +375 -0
  377. package/src/features/styles/styles-with-effects.d.ts +71 -0
  378. package/src/features/styles/styles-with-effects.js +180 -0
  379. package/src/features/styles/table-style.d.ts +272 -0
  380. package/src/features/styles/table-style.js +1226 -0
  381. package/src/features/styles/theme.d.ts +126 -0
  382. package/src/features/styles/theme.js +377 -0
  383. package/src/features/tables/border-style-map.d.ts +24 -0
  384. package/src/features/tables/border-style-map.js +81 -0
  385. package/src/features/tables/borders.d.ts +126 -0
  386. package/src/features/tables/borders.js +527 -0
  387. package/src/features/tables/collections.d.ts +113 -0
  388. package/src/features/tables/collections.js +261 -0
  389. package/src/features/tables/format.d.ts +208 -0
  390. package/src/features/tables/format.js +716 -0
  391. package/src/features/tables/index.d.ts +597 -0
  392. package/src/features/tables/index.js +2386 -0
  393. package/src/features/tables/paddings.d.ts +41 -0
  394. package/src/features/tables/paddings.js +97 -0
  395. package/src/features/tables/tbl-pr-positioning.d.ts +27 -0
  396. package/src/features/tables/tbl-pr-positioning.js +178 -0
  397. package/src/features/tables/tbl-pr.d.ts +528 -0
  398. package/src/features/tables/tbl-pr.js +1208 -0
  399. package/src/features/tables/tc-pr.d.ts +168 -0
  400. package/src/features/tables/tc-pr.js +553 -0
  401. package/src/features/tables/tr-pr.d.ts +60 -0
  402. package/src/features/tables/tr-pr.js +215 -0
  403. package/src/features/watermark/detect.d.ts +76 -0
  404. package/src/features/watermark/detect.js +219 -0
  405. package/src/features/watermark/index.d.ts +28 -0
  406. package/src/features/watermark/index.js +91 -0
  407. package/src/features/watermark/logical-store.d.ts +29 -0
  408. package/src/features/watermark/logical-store.js +31 -0
  409. package/src/features/watermark/model.d.ts +285 -0
  410. package/src/features/watermark/model.js +597 -0
  411. package/src/features/watermark/parse.d.ts +84 -0
  412. package/src/features/watermark/parse.js +815 -0
  413. package/src/features/watermark/serialize.d.ts +98 -0
  414. package/src/features/watermark/serialize.js +1517 -0
  415. package/src/global.js +1 -0
  416. package/src/index.d.ts +2 -0
  417. package/src/index.js +2 -0
@@ -0,0 +1,119 @@
1
+ import { OpenXmlElement } from '../../core/xml/index';
2
+ import { Column } from './column';
3
+ /**
4
+ * Ordered text columns for a section (`w:cols` / `CT_Columns`).
5
+ *
6
+ * Public surface is add-only: {@link count}, {@link add}, index properties, and iteration.
7
+ * Equal-width / separator / default spacing stay internal for OOXML round-trip.
8
+ *
9
+ * @public
10
+ */
11
+ export declare class ColumnCollection {
12
+ private readonly items;
13
+ private equalWidthValue;
14
+ private separatorValue;
15
+ private spacingValue;
16
+ /** When equal-width, schema `w:num` may exceed authored `w:col` children. */
17
+ private equalWidthCount;
18
+ /**
19
+ * @private
20
+ */
21
+ constructor();
22
+ /**
23
+ * Number of columns in this section.
24
+ */
25
+ readonly count: number;
26
+ /**
27
+ * Append a column definition (switches the section to unequal widths).
28
+ *
29
+ * @param width - Column width in points
30
+ * @param space - Space after this column in points (default: half-inch)
31
+ */
32
+ add(width: number, space?: number): Column;
33
+ /**
34
+ * Column at zero-based index, or `undefined` when out of range.
35
+ */
36
+ item(index: number): Column | undefined;
37
+ [index: number]: Column;
38
+ /**
39
+ * Iterate authored column definitions (empty when equal-width with no `w:col` children).
40
+ */
41
+ [Symbol.iterator](): Iterator<Column>;
42
+ /**
43
+ * @private
44
+ */
45
+ readonly equalWidth: boolean;
46
+ /**
47
+ * @private
48
+ */
49
+ setEqualWidth(value: boolean): void;
50
+ /**
51
+ * @private
52
+ */
53
+ readonly separator: boolean;
54
+ /**
55
+ * @private
56
+ */
57
+ setSeparator(value: boolean): void;
58
+ /**
59
+ * @private
60
+ */
61
+ readonly spacing: number;
62
+ /**
63
+ * @private
64
+ */
65
+ setSpacing(value: number): void;
66
+ /**
67
+ * @private
68
+ */
69
+ setEqualWidthCount(count: number): void;
70
+ /**
71
+ * @private
72
+ * Replace contents from a parsed `w:cols` model (atomic).
73
+ */
74
+ replaceFromParsed(options: {
75
+ readonly equalWidth: boolean;
76
+ readonly separator: boolean;
77
+ readonly spacing: number;
78
+ readonly count: number;
79
+ readonly columns: ReadonlyArray<{
80
+ readonly width: number;
81
+ readonly space: number;
82
+ }>;
83
+ }): void;
84
+ /**
85
+ * @private
86
+ */
87
+ clearToDefault(): void;
88
+ /**
89
+ * @private
90
+ */
91
+ cloneDeep(): ColumnCollection;
92
+ /**
93
+ * @private
94
+ * `true` when serialization may omit `w:cols` (schema default single equal column).
95
+ */
96
+ isDefault(): boolean;
97
+ /**
98
+ * @private
99
+ */
100
+ isDefaultTextColumns(): boolean;
101
+ /**
102
+ * @private
103
+ */
104
+ toOpenXmlElement(): OpenXmlElement | undefined;
105
+ }
106
+ /**
107
+ * Factory: n equal-width columns.
108
+ *
109
+ * @private
110
+ */
111
+ export declare function equalWidthColumns(count: number, spacing?: number): ColumnCollection;
112
+ /**
113
+ * @private
114
+ */
115
+ export declare function parseTextColumns(element: OpenXmlElement): ColumnCollection | undefined;
116
+ /**
117
+ * @private
118
+ */
119
+ export declare function serializeTextColumns(value: ColumnCollection): OpenXmlElement;
@@ -0,0 +1,478 @@
1
+ var __values = (this && this.__values) || function (o) {
2
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
3
+ if (m) return m.call(o);
4
+ return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ };
11
+ import { pointToTwips, twipsToPoint } from '../document/length';
12
+ import { elementChildren, isWml, wmlAttr, wmlElement, WML } from '../document/wml';
13
+ import { Column } from './column';
14
+ import { DEFAULT_COLUMN_SPACE, TEXT_COLUMNS_MAX, sectionsError, validateColumnCount, validateSectionLength, } from './section-validation';
15
+ /**
16
+ * Ordered text columns for a section (`w:cols` / `CT_Columns`).
17
+ *
18
+ * Public surface is add-only: {@link count}, {@link add}, index properties, and iteration.
19
+ * Equal-width / separator / default spacing stay internal for OOXML round-trip.
20
+ *
21
+ * @public
22
+ */
23
+ var ColumnCollection = /** @class */ (function () {
24
+ /**
25
+ * @private
26
+ */
27
+ function ColumnCollection() {
28
+ this.items = [];
29
+ this.equalWidthValue = true;
30
+ this.separatorValue = false;
31
+ this.spacingValue = DEFAULT_COLUMN_SPACE;
32
+ /** When equal-width, schema `w:num` may exceed authored `w:col` children. */
33
+ this.equalWidthCount = 1;
34
+ // Default: one equal-width column (omit `w:cols` on serialize).
35
+ }
36
+ Object.defineProperty(ColumnCollection.prototype, "count", {
37
+ /**
38
+ * Number of columns in this section.
39
+ */
40
+ get: function () {
41
+ if (this.equalWidthValue) {
42
+ return this.equalWidthCount;
43
+ }
44
+ return this.items.length === 0 ? 1 : this.items.length;
45
+ },
46
+ enumerable: true,
47
+ configurable: true
48
+ });
49
+ /**
50
+ * Append a column definition (switches the section to unequal widths).
51
+ *
52
+ * @param width - Column width in points
53
+ * @param space - Space after this column in points (default: half-inch)
54
+ */
55
+ ColumnCollection.prototype.add = function (width, space) {
56
+ if (space === void 0) { space = DEFAULT_COLUMN_SPACE; }
57
+ validateSectionLength(width, 'Column.width');
58
+ validateSectionLength(space, 'Column.space');
59
+ if (this.items.length >= TEXT_COLUMNS_MAX) {
60
+ throw sectionsError("text columns cannot exceed " + String(TEXT_COLUMNS_MAX));
61
+ }
62
+ if (this.equalWidthValue) {
63
+ // Transition: freeze equal-width into explicit columns when first unequal add occurs.
64
+ this.equalWidthValue = false;
65
+ if (this.items.length === 0 && this.equalWidthCount > 1) {
66
+ // No prior authored cols — start fresh with the added column only.
67
+ this.equalWidthCount = 1;
68
+ }
69
+ }
70
+ var column = new Column(width, space);
71
+ this.items.push(column);
72
+ return column;
73
+ };
74
+ /**
75
+ * Column at zero-based index, or `undefined` when out of range.
76
+ */
77
+ ColumnCollection.prototype.item = function (index) {
78
+ if (!Number.isInteger(index) || index < 0) {
79
+ return undefined;
80
+ }
81
+ if (this.equalWidthValue) {
82
+ // Equal-width mode has no stable per-column objects unless previously materialized.
83
+ return this.items[index];
84
+ }
85
+ return this.items[index];
86
+ };
87
+ /**
88
+ * Iterate authored column definitions (empty when equal-width with no `w:col` children).
89
+ */
90
+ ColumnCollection.prototype[Symbol.iterator] = function () {
91
+ var snapshot = this.items.slice();
92
+ var i = 0;
93
+ return {
94
+ next: function () {
95
+ if (i >= snapshot.length) {
96
+ return { done: true, value: undefined };
97
+ }
98
+ var value = snapshot[i];
99
+ i += 1;
100
+ return { done: false, value: value };
101
+ },
102
+ };
103
+ };
104
+ Object.defineProperty(ColumnCollection.prototype, "equalWidth", {
105
+ // —— internal OOXML state (not public API) ——
106
+ /**
107
+ * @private
108
+ */
109
+ get: function () {
110
+ return this.equalWidthValue;
111
+ },
112
+ enumerable: true,
113
+ configurable: true
114
+ });
115
+ /**
116
+ * @private
117
+ */
118
+ ColumnCollection.prototype.setEqualWidth = function (value) {
119
+ this.equalWidthValue = value === true;
120
+ if (this.equalWidthValue && this.equalWidthCount < 1) {
121
+ this.equalWidthCount = 1;
122
+ }
123
+ };
124
+ Object.defineProperty(ColumnCollection.prototype, "separator", {
125
+ /**
126
+ * @private
127
+ */
128
+ get: function () {
129
+ return this.separatorValue;
130
+ },
131
+ enumerable: true,
132
+ configurable: true
133
+ });
134
+ /**
135
+ * @private
136
+ */
137
+ ColumnCollection.prototype.setSeparator = function (value) {
138
+ this.separatorValue = value === true;
139
+ };
140
+ Object.defineProperty(ColumnCollection.prototype, "spacing", {
141
+ /**
142
+ * @private
143
+ */
144
+ get: function () {
145
+ return this.spacingValue;
146
+ },
147
+ enumerable: true,
148
+ configurable: true
149
+ });
150
+ /**
151
+ * @private
152
+ */
153
+ ColumnCollection.prototype.setSpacing = function (value) {
154
+ validateSectionLength(value, 'ColumnCollection.spacing');
155
+ this.spacingValue = value;
156
+ };
157
+ /**
158
+ * @private
159
+ */
160
+ ColumnCollection.prototype.setEqualWidthCount = function (count) {
161
+ validateColumnCount(count);
162
+ this.equalWidthCount = count;
163
+ this.equalWidthValue = true;
164
+ };
165
+ /**
166
+ * @private
167
+ * Replace contents from a parsed `w:cols` model (atomic).
168
+ */
169
+ ColumnCollection.prototype.replaceFromParsed = function (options) {
170
+ this.equalWidthValue = options.equalWidth;
171
+ this.separatorValue = options.separator;
172
+ this.spacingValue = options.spacing;
173
+ this.equalWidthCount = options.count;
174
+ this.items.length = 0;
175
+ for (var i = 0; i < options.columns.length; i++) {
176
+ var c = options.columns[i];
177
+ if (c === undefined) {
178
+ continue;
179
+ }
180
+ this.items.push(new Column(c.width, c.space));
181
+ }
182
+ if (!this.equalWidthValue && this.items.length > 0) {
183
+ this.equalWidthCount = this.items.length;
184
+ }
185
+ };
186
+ /**
187
+ * @private
188
+ */
189
+ ColumnCollection.prototype.clearToDefault = function () {
190
+ this.items.length = 0;
191
+ this.equalWidthValue = true;
192
+ this.separatorValue = false;
193
+ this.spacingValue = DEFAULT_COLUMN_SPACE;
194
+ this.equalWidthCount = 1;
195
+ };
196
+ /**
197
+ * @private
198
+ */
199
+ ColumnCollection.prototype.cloneDeep = function () {
200
+ var copy = new ColumnCollection();
201
+ copy.replaceFromParsed({
202
+ equalWidth: this.equalWidthValue,
203
+ separator: this.separatorValue,
204
+ spacing: this.spacingValue,
205
+ count: this.equalWidthCount,
206
+ columns: this.items.map(function (c) { return ({ width: c.width, space: c.spacing }); }),
207
+ });
208
+ return copy;
209
+ };
210
+ /**
211
+ * @private
212
+ * `true` when serialization may omit `w:cols` (schema default single equal column).
213
+ */
214
+ ColumnCollection.prototype.isDefault = function () {
215
+ return (this.isDefaultTextColumns());
216
+ };
217
+ /**
218
+ * @private
219
+ */
220
+ ColumnCollection.prototype.isDefaultTextColumns = function () {
221
+ if (!this.equalWidthValue) {
222
+ return false;
223
+ }
224
+ if (this.separatorValue) {
225
+ return false;
226
+ }
227
+ if (this.equalWidthCount !== 1) {
228
+ return false;
229
+ }
230
+ if (this.spacingValue !== DEFAULT_COLUMN_SPACE) {
231
+ return false;
232
+ }
233
+ return this.items.length === 0;
234
+ };
235
+ /**
236
+ * @private
237
+ */
238
+ ColumnCollection.prototype.toOpenXmlElement = function () {
239
+ if (this.isDefaultTextColumns()) {
240
+ return undefined;
241
+ }
242
+ return serializeTextColumns(this);
243
+ };
244
+ return ColumnCollection;
245
+ }());
246
+ export { ColumnCollection };
247
+ // Indexer implementation for `columns[i]` — assign on prototype for ES5 emit.
248
+ function defineColumnIndexAccessors() {
249
+ var proto = ColumnCollection.prototype;
250
+ var _loop_1 = function (i) {
251
+ var index = i;
252
+ Object.defineProperty(proto, index, {
253
+ configurable: true,
254
+ enumerable: false,
255
+ get: function () {
256
+ return this.item(index);
257
+ },
258
+ });
259
+ };
260
+ for (var i = 0; i < TEXT_COLUMNS_MAX; i++) {
261
+ _loop_1(i);
262
+ }
263
+ }
264
+ defineColumnIndexAccessors();
265
+ /**
266
+ * Factory: n equal-width columns.
267
+ *
268
+ * @private
269
+ */
270
+ export function equalWidthColumns(count, spacing) {
271
+ if (spacing === void 0) { spacing = DEFAULT_COLUMN_SPACE; }
272
+ validateColumnCount(count);
273
+ validateSectionLength(spacing, 'spacing');
274
+ var cols = new ColumnCollection();
275
+ cols.setSpacing(spacing);
276
+ cols.setEqualWidthCount(count);
277
+ cols.setSeparator(false);
278
+ return cols;
279
+ }
280
+ /**
281
+ * @private
282
+ */
283
+ export function parseTextColumns(element) {
284
+ var e_1, _a;
285
+ var equalWidthRaw = wmlAttributeLocal(element, 'equalWidth');
286
+ // Schema default equalWidth=true when attribute omitted.
287
+ var equalWidth = true;
288
+ if (equalWidthRaw !== undefined) {
289
+ var parsed = parseOnOffAttributeLocal(equalWidthRaw);
290
+ if (parsed === undefined) {
291
+ return undefined;
292
+ }
293
+ equalWidth = parsed;
294
+ }
295
+ var sepRaw = wmlAttributeLocal(element, 'sep');
296
+ var separator = false;
297
+ if (sepRaw !== undefined) {
298
+ var parsed = parseOnOffAttributeLocal(sepRaw);
299
+ if (parsed === undefined) {
300
+ return undefined;
301
+ }
302
+ separator = parsed;
303
+ }
304
+ var spacing = DEFAULT_COLUMN_SPACE;
305
+ var spaceRaw = wmlAttributeLocal(element, 'space');
306
+ if (spaceRaw !== undefined) {
307
+ var tw = parseTwipsLocal(spaceRaw);
308
+ if (tw === undefined) {
309
+ return undefined;
310
+ }
311
+ spacing = twipsToPoint(tw);
312
+ }
313
+ var count = 1;
314
+ var numRaw = wmlAttributeLocal(element, 'num');
315
+ if (numRaw !== undefined) {
316
+ if (!/^\d+$/.test(numRaw)) {
317
+ return undefined;
318
+ }
319
+ count = Number.parseInt(numRaw, 10);
320
+ if (count < 1 || count > TEXT_COLUMNS_MAX) {
321
+ return undefined;
322
+ }
323
+ }
324
+ var columns = [];
325
+ try {
326
+ for (var _b = __values(elementChildren(element)), _c = _b.next(); !_c.done; _c = _b.next()) {
327
+ var child = _c.value;
328
+ if (!isWml(child, 'col')) {
329
+ // Unmodeled child → keep whole cols opaque at caller.
330
+ return undefined;
331
+ }
332
+ var wRaw = wmlAttributeLocal(child, 'w');
333
+ if (wRaw === undefined) {
334
+ return undefined;
335
+ }
336
+ var wTw = parseTwipsLocal(wRaw);
337
+ if (wTw === undefined) {
338
+ return undefined;
339
+ }
340
+ var colSpace = DEFAULT_COLUMN_SPACE;
341
+ var colSpaceRaw = wmlAttributeLocal(child, 'space');
342
+ if (colSpaceRaw !== undefined) {
343
+ var sTw = parseTwipsLocal(colSpaceRaw);
344
+ if (sTw === undefined) {
345
+ return undefined;
346
+ }
347
+ colSpace = twipsToPoint(sTw);
348
+ }
349
+ columns.push({ width: twipsToPoint(wTw), space: colSpace });
350
+ if (columns.length > TEXT_COLUMNS_MAX) {
351
+ return undefined;
352
+ }
353
+ }
354
+ }
355
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
356
+ finally {
357
+ try {
358
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
359
+ }
360
+ finally { if (e_1) throw e_1.error; }
361
+ }
362
+ // When unequal and authored cols present, prefer list length as count.
363
+ if (!equalWidth && columns.length > 0) {
364
+ count = columns.length;
365
+ }
366
+ else if (equalWidth && columns.length === 0 && numRaw === undefined) {
367
+ count = 1;
368
+ }
369
+ var result = new ColumnCollection();
370
+ result.replaceFromParsed({
371
+ equalWidth: equalWidth,
372
+ separator: separator,
373
+ spacing: spacing,
374
+ count: count,
375
+ columns: columns,
376
+ });
377
+ return result;
378
+ }
379
+ /**
380
+ * @private
381
+ */
382
+ export function serializeTextColumns(value) {
383
+ var e_2, _a, e_3, _b;
384
+ var attrs = [];
385
+ var equalWidth = value.equalWidth;
386
+ var count = value.count;
387
+ var spacing = value.spacing;
388
+ var separator = value.separator;
389
+ if (!equalWidth) {
390
+ attrs.push(wmlAttr('equalWidth', '0'));
391
+ }
392
+ // Emit num when not the default single column.
393
+ if (count !== 1) {
394
+ attrs.push(wmlAttr('num', String(count)));
395
+ }
396
+ if (spacing !== DEFAULT_COLUMN_SPACE) {
397
+ attrs.push(wmlAttr('space', String(pointToTwips(spacing))));
398
+ }
399
+ if (separator) {
400
+ attrs.push(wmlAttr('sep', '1'));
401
+ }
402
+ var children = [];
403
+ if (!equalWidth) {
404
+ try {
405
+ for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
406
+ var col = value_1_1.value;
407
+ var colAttrs = [
408
+ wmlAttr('w', String(pointToTwips(col.width))),
409
+ ];
410
+ if (col.spacing !== DEFAULT_COLUMN_SPACE) {
411
+ colAttrs.push(wmlAttr('space', String(pointToTwips(col.spacing))));
412
+ }
413
+ children.push(wmlElement('col', { attributes: colAttrs }));
414
+ }
415
+ }
416
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
417
+ finally {
418
+ try {
419
+ if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
420
+ }
421
+ finally { if (e_2) throw e_2.error; }
422
+ }
423
+ }
424
+ else {
425
+ try {
426
+ // Equal-width may still carry residual authored `w:col` children for preservation.
427
+ for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
428
+ var col = value_2_1.value;
429
+ var colAttrs = [
430
+ wmlAttr('w', String(pointToTwips(col.width))),
431
+ ];
432
+ if (col.spacing !== DEFAULT_COLUMN_SPACE) {
433
+ colAttrs.push(wmlAttr('space', String(pointToTwips(col.spacing))));
434
+ }
435
+ children.push(wmlElement('col', { attributes: colAttrs }));
436
+ }
437
+ }
438
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
439
+ finally {
440
+ try {
441
+ if (value_2_1 && !value_2_1.done && (_b = value_2.return)) _b.call(value_2);
442
+ }
443
+ finally { if (e_3) throw e_3.error; }
444
+ }
445
+ }
446
+ return wmlElement('cols', {
447
+ attributes: attrs,
448
+ children: children.length === 0 ? undefined : children,
449
+ });
450
+ }
451
+ function wmlAttributeLocal(el, localName) {
452
+ var found = el.attributes.find(function (a) { return a.localName === localName && (a.namespaceUri === WML || a.namespaceUri === ''); });
453
+ return found == null ? undefined : found.value;
454
+ }
455
+ function parseTwipsLocal(raw) {
456
+ if (raw === undefined || !/^-?\d+$/.test(raw)) {
457
+ return undefined;
458
+ }
459
+ var n = Number.parseInt(raw, 10);
460
+ // Imported bound matches section-validation TWIPS_MAX via page size path; keep local for cols.
461
+ if (n < 0 || n > 31680) {
462
+ return undefined;
463
+ }
464
+ return n;
465
+ }
466
+ function parseOnOffAttributeLocal(raw) {
467
+ if (raw === undefined || raw.length === 0) {
468
+ return true;
469
+ }
470
+ var normalized = raw.trim().toLowerCase();
471
+ if (normalized === 'true' || normalized === '1' || normalized === 'on') {
472
+ return true;
473
+ }
474
+ if (normalized === 'false' || normalized === '0' || normalized === 'off') {
475
+ return false;
476
+ }
477
+ return undefined;
478
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * One explicit text column (`CT_Column`).
3
+ *
4
+ * @public
5
+ */
6
+ export declare class Column {
7
+ private widthValue;
8
+ private spacingValue;
9
+ /**
10
+ * @private
11
+ */
12
+ constructor(width: number, spacing: number);
13
+ width: number;
14
+ spacing: number;
15
+ }
@@ -0,0 +1,37 @@
1
+ import { validateSectionLength } from './section-validation';
2
+ /**
3
+ * One explicit text column (`CT_Column`).
4
+ *
5
+ * @public
6
+ */
7
+ var Column = /** @class */ (function () {
8
+ /**
9
+ * @private
10
+ */
11
+ function Column(width, spacing) {
12
+ this.widthValue = validateSectionLength(width, 'column.width');
13
+ this.spacingValue = validateSectionLength(spacing, 'column.spacing');
14
+ }
15
+ Object.defineProperty(Column.prototype, "width", {
16
+ get: function () {
17
+ return this.widthValue;
18
+ },
19
+ set: function (value) {
20
+ this.widthValue = validateSectionLength(value, 'column.width');
21
+ },
22
+ enumerable: true,
23
+ configurable: true
24
+ });
25
+ Object.defineProperty(Column.prototype, "spacing", {
26
+ get: function () {
27
+ return this.spacingValue;
28
+ },
29
+ set: function (value) {
30
+ this.spacingValue = validateSectionLength(value, 'column.spacing');
31
+ },
32
+ enumerable: true,
33
+ configurable: true
34
+ });
35
+ return Column;
36
+ }());
37
+ export { Column };