@syncfusion/ej2-docx 0.0.0-stage → 35.1.39

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 (416) hide show
  1. package/README.md +68 -2
  2. package/core.js +4 -0
  3. package/dist/ej2-docx.umd.min.js +2 -0
  4. package/dist/ej2-docx.umd.min.js.map +1 -0
  5. package/dist/es6/ej2-docx.es2015.js +66697 -0
  6. package/dist/es6/ej2-docx.es2015.js.map +1 -0
  7. package/dist/es6/ej2-docx.es5.js +77568 -0
  8. package/dist/es6/ej2-docx.es5.js.map +1 -0
  9. package/dist/global/ej2-docx.min.js +2 -0
  10. package/dist/global/ej2-docx.min.js.map +1 -0
  11. package/dist/global/index.d.ts +5 -0
  12. package/features.js +4 -0
  13. package/index.js +4 -0
  14. package/license +10 -0
  15. package/package.json +31 -4
  16. package/src/all.d.ts +50 -0
  17. package/src/all.js +147 -0
  18. package/src/core/compat/base64.d.ts +13 -0
  19. package/src/core/compat/base64.js +90 -0
  20. package/src/core/compat/object-compat.d.ts +30 -0
  21. package/src/core/compat/object-compat.js +40 -0
  22. package/src/core/compat/sha256.d.ts +9 -0
  23. package/src/core/compat/sha256.js +98 -0
  24. package/src/core/errors/docx-error.d.ts +89 -0
  25. package/src/core/errors/docx-error.js +138 -0
  26. package/src/core/errors/error-codes.d.ts +8 -0
  27. package/src/core/errors/error-codes.js +0 -0
  28. package/src/core/errors/index.d.ts +10 -0
  29. package/src/core/errors/index.js +9 -0
  30. package/src/core/index.d.ts +12 -0
  31. package/src/core/index.js +12 -0
  32. package/src/core/mc/alternate-content.d.ts +7 -0
  33. package/src/core/mc/alternate-content.js +67 -0
  34. package/src/core/mc/attributes.d.ts +24 -0
  35. package/src/core/mc/attributes.js +82 -0
  36. package/src/core/mc/index.d.ts +7 -0
  37. package/src/core/mc/index.js +5 -0
  38. package/src/core/mc/inspect.d.ts +16 -0
  39. package/src/core/mc/inspect.js +148 -0
  40. package/src/core/mc/namespaces.d.ts +4 -0
  41. package/src/core/mc/namespaces.js +4 -0
  42. package/src/core/mc/scope.d.ts +6 -0
  43. package/src/core/mc/scope.js +47 -0
  44. package/src/core/opc/content-types.d.ts +34 -0
  45. package/src/core/opc/content-types.js +162 -0
  46. package/src/core/opc/index.d.ts +8 -0
  47. package/src/core/opc/index.js +4 -0
  48. package/src/core/opc/package.d.ts +49 -0
  49. package/src/core/opc/package.js +324 -0
  50. package/src/core/opc/part-name.d.ts +47 -0
  51. package/src/core/opc/part-name.js +205 -0
  52. package/src/core/opc/relationships.d.ts +46 -0
  53. package/src/core/opc/relationships.js +212 -0
  54. package/src/core/preservation/index.d.ts +2 -0
  55. package/src/core/preservation/index.js +1 -0
  56. package/src/core/preservation/opaque-body.d.ts +16 -0
  57. package/src/core/preservation/opaque-body.js +69 -0
  58. package/src/core/registry/block-handlers.d.ts +30 -0
  59. package/src/core/registry/block-handlers.js +36 -0
  60. package/src/core/registry/create-defaults.d.ts +39 -0
  61. package/src/core/registry/create-defaults.js +42 -0
  62. package/src/core/registry/feature-registry.d.ts +20 -0
  63. package/src/core/registry/feature-registry.js +29 -0
  64. package/src/core/registry/index.d.ts +9 -0
  65. package/src/core/registry/index.js +8 -0
  66. package/src/core/registry/inline-handlers.d.ts +20 -0
  67. package/src/core/registry/inline-handlers.js +30 -0
  68. package/src/core/registry/materialize-handlers.d.ts +35 -0
  69. package/src/core/registry/materialize-handlers.js +75 -0
  70. package/src/core/registry/multi-part-handlers.d.ts +37 -0
  71. package/src/core/registry/multi-part-handlers.js +206 -0
  72. package/src/core/registry/package-part-handlers.d.ts +28 -0
  73. package/src/core/registry/package-part-handlers.js +190 -0
  74. package/src/core/registry/part-handlers.d.ts +24 -0
  75. package/src/core/registry/part-handlers.js +172 -0
  76. package/src/core/registry/run-leaf-handlers.d.ts +26 -0
  77. package/src/core/registry/run-leaf-handlers.js +72 -0
  78. package/src/core/security/limits.d.ts +40 -0
  79. package/src/core/security/limits.js +26 -0
  80. package/src/core/xml/index.d.ts +7 -0
  81. package/src/core/xml/index.js +3 -0
  82. package/src/core/xml/model.d.ts +66 -0
  83. package/src/core/xml/model.js +17 -0
  84. package/src/core/xml/parse.d.ts +12 -0
  85. package/src/core/xml/parse.js +382 -0
  86. package/src/core/xml/serialize.d.ts +6 -0
  87. package/src/core/xml/serialize.js +93 -0
  88. package/src/core/zip/crc32.d.ts +2 -0
  89. package/src/core/zip/crc32.js +25 -0
  90. package/src/core/zip/deflate.d.ts +6 -0
  91. package/src/core/zip/deflate.js +6 -0
  92. package/src/core/zip/index.d.ts +10 -0
  93. package/src/core/zip/index.js +4 -0
  94. package/src/core/zip/inflate-raw.d.ts +17 -0
  95. package/src/core/zip/inflate-raw.js +450 -0
  96. package/src/core/zip/names.d.ts +6 -0
  97. package/src/core/zip/names.js +52 -0
  98. package/src/core/zip/read.d.ts +8 -0
  99. package/src/core/zip/read.js +262 -0
  100. package/src/core/zip/write.d.ts +7 -0
  101. package/src/core/zip/write.js +189 -0
  102. package/src/core/zip/zip-entry.d.ts +4 -0
  103. package/src/core/zip/zip-entry.js +0 -0
  104. package/src/features/bibliography/index.d.ts +100 -0
  105. package/src/features/bibliography/index.js +290 -0
  106. package/src/features/bookmarks/index.d.ts +331 -0
  107. package/src/features/bookmarks/index.js +1009 -0
  108. package/src/features/comments/comment-extensions.d.ts +157 -0
  109. package/src/features/comments/comment-extensions.js +356 -0
  110. package/src/features/comments/index.d.ts +579 -0
  111. package/src/features/comments/index.js +1727 -0
  112. package/src/features/content-controls/index.d.ts +821 -0
  113. package/src/features/content-controls/index.js +2857 -0
  114. package/src/features/custom-xml/index.d.ts +236 -0
  115. package/src/features/custom-xml/index.js +661 -0
  116. package/src/features/document/alignment.d.ts +23 -0
  117. package/src/features/document/alignment.js +36 -0
  118. package/src/features/document/alt-chunk.d.ts +103 -0
  119. package/src/features/document/alt-chunk.js +221 -0
  120. package/src/features/document/assert-never.d.ts +1 -0
  121. package/src/features/document/assert-never.js +4 -0
  122. package/src/features/document/augmentations.d.ts +578 -0
  123. package/src/features/document/augmentations.js +0 -0
  124. package/src/features/document/body-always-on.d.ts +36 -0
  125. package/src/features/document/body-always-on.js +66 -0
  126. package/src/features/document/body-blocks.d.ts +7 -0
  127. package/src/features/document/body-blocks.js +78 -0
  128. package/src/features/document/body-item-adapters.d.ts +62 -0
  129. package/src/features/document/body-item-adapters.js +97 -0
  130. package/src/features/document/body-item-collection.d.ts +151 -0
  131. package/src/features/document/body-item-collection.js +440 -0
  132. package/src/features/document/body-item.d.ts +35 -0
  133. package/src/features/document/body-item.js +8 -0
  134. package/src/features/document/body.d.ts +150 -0
  135. package/src/features/document/body.js +263 -0
  136. package/src/features/document/character-format.d.ts +413 -0
  137. package/src/features/document/character-format.js +2054 -0
  138. package/src/features/document/color.d.ts +178 -0
  139. package/src/features/document/color.js +495 -0
  140. package/src/features/document/document.d.ts +410 -0
  141. package/src/features/document/document.js +1049 -0
  142. package/src/features/document/element-type.d.ts +68 -0
  143. package/src/features/document/element-type.js +133 -0
  144. package/src/features/document/entity-type.d.ts +92 -0
  145. package/src/features/document/entity-type.js +93 -0
  146. package/src/features/document/feature-block.d.ts +16 -0
  147. package/src/features/document/feature-block.js +0 -0
  148. package/src/features/document/feature-inline.d.ts +13 -0
  149. package/src/features/document/feature-inline.js +0 -0
  150. package/src/features/document/feature-multi-package-part.d.ts +19 -0
  151. package/src/features/document/feature-multi-package-part.js +8 -0
  152. package/src/features/document/feature-package-level-part.d.ts +18 -0
  153. package/src/features/document/feature-package-level-part.js +8 -0
  154. package/src/features/document/feature-package-part.d.ts +14 -0
  155. package/src/features/document/feature-package-part.js +0 -0
  156. package/src/features/document/feature-run-leaf.d.ts +9 -0
  157. package/src/features/document/feature-run-leaf.js +0 -0
  158. package/src/features/document/headers-footers.d.ts +206 -0
  159. package/src/features/document/headers-footers.js +384 -0
  160. package/src/features/document/index.d.ts +41 -0
  161. package/src/features/document/index.js +34 -0
  162. package/src/features/document/length.d.ts +152 -0
  163. package/src/features/document/length.js +245 -0
  164. package/src/features/document/load-options.d.ts +14 -0
  165. package/src/features/document/load-options.js +0 -0
  166. package/src/features/document/locale-ids.d.ts +227 -0
  167. package/src/features/document/locale-ids.js +485 -0
  168. package/src/features/document/on-off.d.ts +9 -0
  169. package/src/features/document/on-off.js +27 -0
  170. package/src/features/document/page-setup.d.ts +339 -0
  171. package/src/features/document/page-setup.js +244 -0
  172. package/src/features/document/paragraph-format.d.ts +880 -0
  173. package/src/features/document/paragraph-format.js +2807 -0
  174. package/src/features/document/paragraph-item-collection.d.ts +162 -0
  175. package/src/features/document/paragraph-item-collection.js +363 -0
  176. package/src/features/document/paragraph-item.d.ts +83 -0
  177. package/src/features/document/paragraph-item.js +103 -0
  178. package/src/features/document/paragraph.d.ts +435 -0
  179. package/src/features/document/paragraph.js +888 -0
  180. package/src/features/document/run.d.ts +1 -0
  181. package/src/features/document/run.js +768 -0
  182. package/src/features/document/section-partition-flatten.d.ts +124 -0
  183. package/src/features/document/section-partition-flatten.js +217 -0
  184. package/src/features/document/section-properties-model.d.ts +13 -0
  185. package/src/features/document/section-properties-model.js +0 -0
  186. package/src/features/document/section.d.ts +93 -0
  187. package/src/features/document/section.js +178 -0
  188. package/src/features/document/sections.d.ts +103 -0
  189. package/src/features/document/sections.js +217 -0
  190. package/src/features/document/sub-super-script.d.ts +23 -0
  191. package/src/features/document/sub-super-script.js +43 -0
  192. package/src/features/document/text-range.d.ts +445 -0
  193. package/src/features/document/text-range.js +1156 -0
  194. package/src/features/document/typed-body-collections.d.ts +162 -0
  195. package/src/features/document/typed-body-collections.js +371 -0
  196. package/src/features/document/underline-style.d.ts +38 -0
  197. package/src/features/document/underline-style.js +126 -0
  198. package/src/features/document/units.d.ts +8 -0
  199. package/src/features/document/units.js +7 -0
  200. package/src/features/document/wml.d.ts +16 -0
  201. package/src/features/document/wml.js +67 -0
  202. package/src/features/drawing/authoring.d.ts +27 -0
  203. package/src/features/drawing/authoring.js +271 -0
  204. package/src/features/drawing/body-pr.d.ts +271 -0
  205. package/src/features/drawing/body-pr.js +663 -0
  206. package/src/features/drawing/drawing-shape.d.ts +1192 -0
  207. package/src/features/drawing/drawing-shape.js +3239 -0
  208. package/src/features/drawing/encode-builders.d.ts +176 -0
  209. package/src/features/drawing/encode-builders.js +390 -0
  210. package/src/features/drawing/fill-format.d.ts +52 -0
  211. package/src/features/drawing/fill-format.js +124 -0
  212. package/src/features/drawing/host-codec.d.ts +632 -0
  213. package/src/features/drawing/host-codec.js +2595 -0
  214. package/src/features/drawing/index.d.ts +13 -0
  215. package/src/features/drawing/index.js +33 -0
  216. package/src/features/drawing/line-format.d.ts +76 -0
  217. package/src/features/drawing/line-format.js +343 -0
  218. package/src/features/drawing/parse-register.d.ts +50 -0
  219. package/src/features/drawing/parse-register.js +257 -0
  220. package/src/features/drawing/residual-utils.d.ts +47 -0
  221. package/src/features/drawing/residual-utils.js +290 -0
  222. package/src/features/drawing/shape-types.d.ts +433 -0
  223. package/src/features/drawing/shape-types.js +437 -0
  224. package/src/features/drawing/sp-pr.d.ts +396 -0
  225. package/src/features/drawing/sp-pr.js +610 -0
  226. package/src/features/drawing/text-frame.d.ts +90 -0
  227. package/src/features/drawing/text-frame.js +152 -0
  228. package/src/features/drawing/types.d.ts +352 -0
  229. package/src/features/drawing/types.js +60 -0
  230. package/src/features/drawing/wrap-format.d.ts +62 -0
  231. package/src/features/drawing/wrap-format.js +114 -0
  232. package/src/features/editable-ranges/index.d.ts +494 -0
  233. package/src/features/editable-ranges/index.js +1348 -0
  234. package/src/features/fields/index.d.ts +428 -0
  235. package/src/features/fields/index.js +2148 -0
  236. package/src/features/fields/paragraph-field.d.ts +187 -0
  237. package/src/features/fields/paragraph-field.js +692 -0
  238. package/src/features/font-table/font-substitution-table.d.ts +75 -0
  239. package/src/features/font-table/font-substitution-table.js +257 -0
  240. package/src/features/font-table/font-table-entry.d.ts +255 -0
  241. package/src/features/font-table/font-table-entry.js +823 -0
  242. package/src/features/font-table/font-table.d.ts +128 -0
  243. package/src/features/font-table/font-table.js +313 -0
  244. package/src/features/font-table/index.d.ts +27 -0
  245. package/src/features/font-table/index.js +48 -0
  246. package/src/features/glossary/index.d.ts +97 -0
  247. package/src/features/glossary/index.js +286 -0
  248. package/src/features/headers-footers/index.d.ts +506 -0
  249. package/src/features/headers-footers/index.js +1666 -0
  250. package/src/features/hyperlinks/index.d.ts +230 -0
  251. package/src/features/hyperlinks/index.js +685 -0
  252. package/src/features/images/caption-authoring-api.d.ts +33 -0
  253. package/src/features/images/caption-authoring-api.js +33 -0
  254. package/src/features/images/caption-enums.d.ts +52 -0
  255. package/src/features/images/caption-enums.js +141 -0
  256. package/src/features/images/caption-host.d.ts +10 -0
  257. package/src/features/images/caption-host.js +21 -0
  258. package/src/features/images/captions.d.ts +13 -0
  259. package/src/features/images/captions.js +142 -0
  260. package/src/features/images/host-codec.d.ts +103 -0
  261. package/src/features/images/host-codec.js +720 -0
  262. package/src/features/images/image-sniff.d.ts +21 -0
  263. package/src/features/images/image-sniff.js +71 -0
  264. package/src/features/images/index.d.ts +506 -0
  265. package/src/features/images/index.js +1429 -0
  266. package/src/features/images/layout-types.d.ts +232 -0
  267. package/src/features/images/layout-types.js +294 -0
  268. package/src/features/images/public-entry.d.ts +9 -0
  269. package/src/features/images/public-entry.js +9 -0
  270. package/src/features/index.d.ts +35 -0
  271. package/src/features/index.js +36 -0
  272. package/src/features/mail-merge/index.d.ts +113 -0
  273. package/src/features/mail-merge/index.js +315 -0
  274. package/src/features/notes/index.d.ts +573 -0
  275. package/src/features/notes/index.js +1725 -0
  276. package/src/features/numbering/abstract-numbering.d.ts +90 -0
  277. package/src/features/numbering/abstract-numbering.js +292 -0
  278. package/src/features/numbering/index.d.ts +182 -0
  279. package/src/features/numbering/index.js +668 -0
  280. package/src/features/numbering/list-format.d.ts +158 -0
  281. package/src/features/numbering/list-format.js +590 -0
  282. package/src/features/numbering/list-string.d.ts +7 -0
  283. package/src/features/numbering/list-string.js +423 -0
  284. package/src/features/numbering/list-style.d.ts +204 -0
  285. package/src/features/numbering/list-style.js +1084 -0
  286. package/src/features/numbering/numbering-instance.d.ts +101 -0
  287. package/src/features/numbering/numbering-instance.js +329 -0
  288. package/src/features/numbering/numbering-level.d.ts +118 -0
  289. package/src/features/numbering/numbering-level.js +501 -0
  290. package/src/features/numbering/picture-bullet.d.ts +34 -0
  291. package/src/features/numbering/picture-bullet.js +88 -0
  292. package/src/features/ole-object/catalog.d.ts +300 -0
  293. package/src/features/ole-object/catalog.js +908 -0
  294. package/src/features/ole-object/index.d.ts +526 -0
  295. package/src/features/ole-object/index.js +1421 -0
  296. package/src/features/ole-object/relationship.d.ts +27 -0
  297. package/src/features/ole-object/relationship.js +27 -0
  298. package/src/features/ole-object/typed-dom.d.ts +186 -0
  299. package/src/features/ole-object/typed-dom.js +595 -0
  300. package/src/features/properties/index.d.ts +205 -0
  301. package/src/features/properties/index.js +549 -0
  302. package/src/features/revisions/index.d.ts +204 -0
  303. package/src/features/revisions/index.js +695 -0
  304. package/src/features/sections/column-collection.d.ts +119 -0
  305. package/src/features/sections/column-collection.js +478 -0
  306. package/src/features/sections/column.d.ts +15 -0
  307. package/src/features/sections/column.js +37 -0
  308. package/src/features/sections/index.d.ts +91 -0
  309. package/src/features/sections/index.js +1096 -0
  310. package/src/features/sections/margins.d.ts +40 -0
  311. package/src/features/sections/margins.js +105 -0
  312. package/src/features/sections/page-number-style.d.ts +21 -0
  313. package/src/features/sections/page-number-style.js +62 -0
  314. package/src/features/sections/page-orientation.d.ts +10 -0
  315. package/src/features/sections/page-orientation.js +10 -0
  316. package/src/features/sections/page-setup.d.ts +435 -0
  317. package/src/features/sections/page-setup.js +1479 -0
  318. package/src/features/sections/page-size.d.ts +59 -0
  319. package/src/features/sections/page-size.js +68 -0
  320. package/src/features/sections/section-break-code.d.ts +27 -0
  321. package/src/features/sections/section-break-code.js +60 -0
  322. package/src/features/sections/section-document-association.d.ts +18 -0
  323. package/src/features/sections/section-document-association.js +31 -0
  324. package/src/features/sections/section-validation.d.ts +43 -0
  325. package/src/features/sections/section-validation.js +97 -0
  326. package/src/features/settings/attached-template.d.ts +35 -0
  327. package/src/features/settings/attached-template.js +98 -0
  328. package/src/features/settings/compat-settings.d.ts +216 -0
  329. package/src/features/settings/compat-settings.js +508 -0
  330. package/src/features/settings/document-background.d.ts +59 -0
  331. package/src/features/settings/document-background.js +131 -0
  332. package/src/features/settings/document-protection.d.ts +65 -0
  333. package/src/features/settings/document-protection.js +157 -0
  334. package/src/features/settings/document-settings-facades.d.ts +108 -0
  335. package/src/features/settings/document-settings-facades.js +312 -0
  336. package/src/features/settings/document-settings-values.d.ts +43 -0
  337. package/src/features/settings/document-settings-values.js +60 -0
  338. package/src/features/settings/footnote-properties.d.ts +211 -0
  339. package/src/features/settings/footnote-properties.js +591 -0
  340. package/src/features/settings/index.d.ts +356 -0
  341. package/src/features/settings/index.js +829 -0
  342. package/src/features/settings/settings-children.d.ts +151 -0
  343. package/src/features/settings/settings-children.js +505 -0
  344. package/src/features/settings/web-settings.d.ts +88 -0
  345. package/src/features/settings/web-settings.js +227 -0
  346. package/src/features/settings/zoom.d.ts +79 -0
  347. package/src/features/settings/zoom.js +147 -0
  348. package/src/features/styles/builtin-catalog.d.ts +159 -0
  349. package/src/features/styles/builtin-catalog.js +963 -0
  350. package/src/features/styles/builtin-resolver.d.ts +49 -0
  351. package/src/features/styles/builtin-resolver.js +165 -0
  352. package/src/features/styles/default-styles.d.ts +37 -0
  353. package/src/features/styles/default-styles.js +186 -0
  354. package/src/features/styles/default-theme.d.ts +13 -0
  355. package/src/features/styles/default-theme.js +13 -0
  356. package/src/features/styles/doc-defaults.d.ts +58 -0
  357. package/src/features/styles/doc-defaults.js +178 -0
  358. package/src/features/styles/formatting-resolver.d.ts +27 -0
  359. package/src/features/styles/formatting-resolver.js +72 -0
  360. package/src/features/styles/index.d.ts +256 -0
  361. package/src/features/styles/index.js +1325 -0
  362. package/src/features/styles/latent-styles.d.ts +68 -0
  363. package/src/features/styles/latent-styles.js +305 -0
  364. package/src/features/styles/paragraph-properties.d.ts +71 -0
  365. package/src/features/styles/paragraph-properties.js +237 -0
  366. package/src/features/styles/run-properties.d.ts +93 -0
  367. package/src/features/styles/run-properties.js +516 -0
  368. package/src/features/styles/style-base.d.ts +402 -0
  369. package/src/features/styles/style-base.js +1026 -0
  370. package/src/features/styles/style-collection.d.ts +264 -0
  371. package/src/features/styles/style-collection.js +714 -0
  372. package/src/features/styles/style-format-bridge.d.ts +64 -0
  373. package/src/features/styles/style-format-bridge.js +100 -0
  374. package/src/features/styles/style.d.ts +84 -0
  375. package/src/features/styles/style.js +375 -0
  376. package/src/features/styles/styles-with-effects.d.ts +71 -0
  377. package/src/features/styles/styles-with-effects.js +180 -0
  378. package/src/features/styles/table-style.d.ts +272 -0
  379. package/src/features/styles/table-style.js +1226 -0
  380. package/src/features/styles/theme.d.ts +126 -0
  381. package/src/features/styles/theme.js +377 -0
  382. package/src/features/tables/border-style-map.d.ts +24 -0
  383. package/src/features/tables/border-style-map.js +81 -0
  384. package/src/features/tables/borders.d.ts +126 -0
  385. package/src/features/tables/borders.js +527 -0
  386. package/src/features/tables/collections.d.ts +113 -0
  387. package/src/features/tables/collections.js +261 -0
  388. package/src/features/tables/format.d.ts +208 -0
  389. package/src/features/tables/format.js +716 -0
  390. package/src/features/tables/index.d.ts +597 -0
  391. package/src/features/tables/index.js +2386 -0
  392. package/src/features/tables/paddings.d.ts +41 -0
  393. package/src/features/tables/paddings.js +97 -0
  394. package/src/features/tables/tbl-pr-positioning.d.ts +27 -0
  395. package/src/features/tables/tbl-pr-positioning.js +178 -0
  396. package/src/features/tables/tbl-pr.d.ts +528 -0
  397. package/src/features/tables/tbl-pr.js +1208 -0
  398. package/src/features/tables/tc-pr.d.ts +168 -0
  399. package/src/features/tables/tc-pr.js +553 -0
  400. package/src/features/tables/tr-pr.d.ts +60 -0
  401. package/src/features/tables/tr-pr.js +215 -0
  402. package/src/features/watermark/detect.d.ts +76 -0
  403. package/src/features/watermark/detect.js +219 -0
  404. package/src/features/watermark/index.d.ts +28 -0
  405. package/src/features/watermark/index.js +91 -0
  406. package/src/features/watermark/logical-store.d.ts +29 -0
  407. package/src/features/watermark/logical-store.js +31 -0
  408. package/src/features/watermark/model.d.ts +285 -0
  409. package/src/features/watermark/model.js +597 -0
  410. package/src/features/watermark/parse.d.ts +84 -0
  411. package/src/features/watermark/parse.js +815 -0
  412. package/src/features/watermark/serialize.d.ts +98 -0
  413. package/src/features/watermark/serialize.js +1517 -0
  414. package/src/global.js +1 -0
  415. package/src/index.d.ts +2 -0
  416. package/src/index.js +2 -0
@@ -0,0 +1,1096 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ return new (P || (P = Promise))(function (resolve, reject) {
3
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7
+ });
8
+ };
9
+ var __generator = (this && this.__generator) || function (thisArg, body) {
10
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ function verb(n) { return function (v) { return step([n, v]); }; }
13
+ function step(op) {
14
+ if (f) throw new TypeError("Generator is already executing.");
15
+ while (_) try {
16
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
17
+ if (y = 0, t) op = [op[0] & 2, t.value];
18
+ switch (op[0]) {
19
+ case 0: case 1: t = op; break;
20
+ case 4: _.label++; return { value: op[1], done: false };
21
+ case 5: _.label++; y = op[1]; op = [0]; continue;
22
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
23
+ default:
24
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
25
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
26
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
27
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
28
+ if (t[2]) _.ops.pop();
29
+ _.trys.pop(); continue;
30
+ }
31
+ op = body.call(thisArg, _);
32
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
33
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
34
+ }
35
+ };
36
+ var __values = (this && this.__values) || function (o) {
37
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
38
+ if (m) return m.call(o);
39
+ return {
40
+ next: function () {
41
+ if (o && i >= o.length) o = void 0;
42
+ return { value: o && o[i++], done: !o };
43
+ }
44
+ };
45
+ };
46
+ export * from './column-collection';
47
+ export * from './column';
48
+ export * from './margins';
49
+ export * from './page-number-style';
50
+ export * from './page-orientation';
51
+ export * from './page-size';
52
+ export * from './section-break-code';
53
+ export * from './section-document-association';
54
+ export * from './section-validation';
55
+ import { registerAlwaysOnBodyFeatureBootstrap } from '../document/body-always-on';
56
+ import { WordDocument } from '../document/document';
57
+ import { pointToTwips, twipsToPoint } from '../document/length';
58
+ import { parseOnOff } from '../document/on-off';
59
+ import { Paragraph } from '../document/paragraph';
60
+ import { Section } from '../document/section';
61
+ import { registerSectionPropertiesAttached, registerSectionPropertiesParse, resetSectionPropertiesAttachedForTests, resetSectionPropertiesParseForTests, } from '../document/section-partition-flatten';
62
+ import { registerSectionPageSetupClone, registerSectionPageSetupSeed, resetSectionPageSetupCloneForTests, resetSectionPageSetupSeedForTests, } from '../document/sections';
63
+ import { elementChildren, isWml, wValAttribute, WML, } from '../document/wml';
64
+ import { featureId, isFeatureRegistered, registerFeature, } from '../../core/registry/index';
65
+ import { parseTextColumns, } from './column-collection';
66
+ import { PageOrientation } from './page-orientation';
67
+ import { pageNumberStyleFromWire, } from './page-number-style';
68
+ import { defaultLetterPageSetup, PageSetup, } from './page-setup';
69
+ import { PageSize } from './page-size';
70
+ import { wireToBreakCode, } from './section-break-code';
71
+ import { associatePageSetupDocument, ownerDocumentOf, } from './section-document-association';
72
+ import { DEFAULT_COLUMN_SPACE, TWIPS_MAX, } from './section-validation';
73
+ var SECTIONS = featureId('sections');
74
+ var HEADERS_FOOTERS_FEATURE_ID = 'headers-footers';
75
+ /** Office WordDocument relationships namespace for `r:id` on `CT_Rel`. */
76
+ var RELATIONSHIPS_OFFICE_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
77
+ /** Letter defaults when `w:pgSz` / `w:pgMar` are absent on load. */
78
+ var LETTER_WIDTH = PageSize.Letter.width;
79
+ var LETTER_HEIGHT = PageSize.Letter.height;
80
+ var DEFAULT_MARGIN = 72;
81
+ var DEFAULT_HEADER_FOOTER_DISTANCE = 36;
82
+ var DEFAULT_GUTTER = 0;
83
+ var PAGE_BORDER_STYLES = new Set([
84
+ 'nil',
85
+ 'none',
86
+ 'single',
87
+ 'thick',
88
+ 'double',
89
+ 'dotted',
90
+ 'dashed',
91
+ 'dotDash',
92
+ 'dotDotDash',
93
+ 'triple',
94
+ 'thinThickSmallGap',
95
+ 'thickThinSmallGap',
96
+ 'thinThickThinSmallGap',
97
+ 'thinThickMediumGap',
98
+ 'thickThinMediumGap',
99
+ 'thinThickThinMediumGap',
100
+ 'thinThickLargeGap',
101
+ 'thickThinLargeGap',
102
+ 'thinThickThinLargeGap',
103
+ 'wave',
104
+ 'doubleWave',
105
+ 'dashSmallGap',
106
+ 'dashDotStroked',
107
+ 'threeDEmboss',
108
+ 'threeDEngrave',
109
+ 'outset',
110
+ 'inset',
111
+ ]);
112
+ // —— re-exports (public / private package surface) ——
113
+ export { BorderStyle, defaultLetterPageSetup, LineNumberingMode, PageBorder, PageBorderOffsetFrom, PageBorders, PageBordersApplyType, PageSetup, PrinterPaperTray, VerticalAlignment, } from './page-setup';
114
+ function sectionsError(message) {
115
+ return new Error("sections: " + message);
116
+ }
117
+ function relIdAttribute(el) {
118
+ var found = el.attributes.find(function (a) { return a.localName === 'id' && a.namespaceUri === RELATIONSHIPS_OFFICE_NS; });
119
+ return found == null ? undefined : found.value;
120
+ }
121
+ function relIdAttr(value) {
122
+ return {
123
+ namespaceUri: RELATIONSHIPS_OFFICE_NS,
124
+ localName: 'id',
125
+ prefix: 'r',
126
+ value: value,
127
+ };
128
+ }
129
+ function wmlAttribute(el, localName) {
130
+ var found = el.attributes.find(function (a) {
131
+ return a.localName === localName &&
132
+ (a.namespaceUri === WML || a.namespaceUri === '');
133
+ });
134
+ return found == null ? undefined : found.value;
135
+ }
136
+ function parseTwips(raw) {
137
+ if (raw === undefined || !/^-?\d+$/.test(raw)) {
138
+ return undefined;
139
+ }
140
+ var n = Number.parseInt(raw, 10);
141
+ if (n < 0 || n > TWIPS_MAX) {
142
+ return undefined;
143
+ }
144
+ return n;
145
+ }
146
+ function parseUnsignedInt(raw) {
147
+ if (raw === undefined || !/^\d+$/.test(raw)) {
148
+ return undefined;
149
+ }
150
+ return Number.parseInt(raw, 10);
151
+ }
152
+ function parseOnOffAttribute(raw) {
153
+ if (raw === undefined || raw.length === 0) {
154
+ return true;
155
+ }
156
+ var normalized = raw.trim().toLowerCase();
157
+ if (normalized === 'true' || normalized === '1' || normalized === 'on') {
158
+ return true;
159
+ }
160
+ if (normalized === 'false' || normalized === '0' || normalized === 'off') {
161
+ return false;
162
+ }
163
+ return undefined;
164
+ }
165
+ function parseHeaderFooterReference(element) {
166
+ var kind = isWml(element, 'headerReference')
167
+ ? 'header'
168
+ : isWml(element, 'footerReference')
169
+ ? 'footer'
170
+ : undefined;
171
+ if (kind === undefined) {
172
+ return undefined;
173
+ }
174
+ var relationshipId = relIdAttribute(element);
175
+ var typeRaw = wmlAttribute(element, 'type');
176
+ var refType = typeRaw === 'default' || typeRaw === 'first' || typeRaw === 'even'
177
+ ? typeRaw
178
+ : undefined;
179
+ if (relationshipId === undefined || refType === undefined) {
180
+ return undefined;
181
+ }
182
+ return { kind: kind, refType: refType, relationshipId: relationshipId };
183
+ }
184
+ function parseSectionMarkWire(element) {
185
+ var val = wValAttribute(element);
186
+ if (val === 'newPage' ||
187
+ val === 'continuous' ||
188
+ val === 'nextColumn' ||
189
+ val === 'evenPage' ||
190
+ val === 'oddPage') {
191
+ return val;
192
+ }
193
+ return undefined;
194
+ }
195
+ function parsePageSizeFields(element) {
196
+ var wRaw = parseTwips(wmlAttribute(element, 'w'));
197
+ var hRaw = parseTwips(wmlAttribute(element, 'h'));
198
+ if (wRaw === undefined || hRaw === undefined) {
199
+ return undefined;
200
+ }
201
+ var orientRaw = wmlAttribute(element, 'orient');
202
+ var orientation;
203
+ if (orientRaw === 'landscape') {
204
+ orientation = PageOrientation.Landscape;
205
+ }
206
+ else if (orientRaw === 'portrait') {
207
+ orientation = PageOrientation.Portrait;
208
+ }
209
+ return {
210
+ width: twipsToPoint(wRaw),
211
+ height: twipsToPoint(hRaw),
212
+ orientation: orientation,
213
+ };
214
+ }
215
+ function parsePageMarginFields(element) {
216
+ var topRaw = parseTwips(wmlAttribute(element, 'top'));
217
+ var rightRaw = parseTwips(wmlAttribute(element, 'right'));
218
+ var bottomRaw = parseTwips(wmlAttribute(element, 'bottom'));
219
+ var leftRaw = parseTwips(wmlAttribute(element, 'left'));
220
+ var headerRaw = parseTwips(wmlAttribute(element, 'header'));
221
+ var footerRaw = parseTwips(wmlAttribute(element, 'footer'));
222
+ var gutterRaw = parseTwips(wmlAttribute(element, 'gutter'));
223
+ if (topRaw === undefined ||
224
+ rightRaw === undefined ||
225
+ bottomRaw === undefined ||
226
+ leftRaw === undefined ||
227
+ headerRaw === undefined ||
228
+ footerRaw === undefined ||
229
+ gutterRaw === undefined) {
230
+ return undefined;
231
+ }
232
+ return {
233
+ top: twipsToPoint(topRaw),
234
+ right: twipsToPoint(rightRaw),
235
+ bottom: twipsToPoint(bottomRaw),
236
+ left: twipsToPoint(leftRaw),
237
+ header: twipsToPoint(headerRaw),
238
+ footer: twipsToPoint(footerRaw),
239
+ gutter: twipsToPoint(gutterRaw),
240
+ };
241
+ }
242
+ function parsePaperSource(element) {
243
+ var firstRaw = wmlAttribute(element, 'first');
244
+ var otherRaw = wmlAttribute(element, 'other');
245
+ var firstPageTray;
246
+ var otherPagesTray;
247
+ if (firstRaw !== undefined) {
248
+ firstPageTray = parseUnsignedInt(firstRaw);
249
+ if (firstPageTray === undefined) {
250
+ return undefined;
251
+ }
252
+ }
253
+ if (otherRaw !== undefined) {
254
+ otherPagesTray = parseUnsignedInt(otherRaw);
255
+ if (otherPagesTray === undefined) {
256
+ return undefined;
257
+ }
258
+ }
259
+ if (firstPageTray === undefined && otherPagesTray === undefined) {
260
+ return undefined;
261
+ }
262
+ return { firstPageTray: firstPageTray, otherPagesTray: otherPagesTray };
263
+ }
264
+ function parseLineNumbering(element) {
265
+ var countByRaw = wmlAttribute(element, 'countBy');
266
+ if (countByRaw === undefined) {
267
+ return undefined;
268
+ }
269
+ if (!/^\d+$/.test(countByRaw)) {
270
+ return undefined;
271
+ }
272
+ var countBy = Number.parseInt(countByRaw, 10);
273
+ if (countBy < 1) {
274
+ return undefined;
275
+ }
276
+ var restart;
277
+ var restartRaw = wmlAttribute(element, 'restart');
278
+ if (restartRaw !== undefined) {
279
+ if (restartRaw !== 'newPage' &&
280
+ restartRaw !== 'newSection' &&
281
+ restartRaw !== 'continuous') {
282
+ return undefined;
283
+ }
284
+ restart = restartRaw === 'newPage' ? undefined : restartRaw;
285
+ }
286
+ var startAt;
287
+ var startRaw = wmlAttribute(element, 'start');
288
+ if (startRaw !== undefined) {
289
+ if (!/^\d+$/.test(startRaw)) {
290
+ return undefined;
291
+ }
292
+ startAt = Number.parseInt(startRaw, 10);
293
+ }
294
+ var distanceFromText;
295
+ var distanceRaw = wmlAttribute(element, 'distance');
296
+ if (distanceRaw !== undefined) {
297
+ var parsed = parseTwips(distanceRaw);
298
+ if (parsed === undefined) {
299
+ return undefined;
300
+ }
301
+ distanceFromText = twipsToPoint(parsed);
302
+ }
303
+ return {
304
+ countBy: countBy,
305
+ restart: restart,
306
+ startAt: startAt,
307
+ distanceFromText: distanceFromText,
308
+ };
309
+ }
310
+ function parseChapterSeparator(raw) {
311
+ if (raw === 'hyphen' ||
312
+ raw === 'period' ||
313
+ raw === 'colon' ||
314
+ raw === 'emDash' ||
315
+ raw === 'enDash') {
316
+ return raw;
317
+ }
318
+ return undefined;
319
+ }
320
+ function parsePageNumberingFields(element) {
321
+ var fmtRaw = wmlAttribute(element, 'fmt');
322
+ // Absent fmt → schema default decimal. Unknown fmt → opaque (never coerce).
323
+ if (fmtRaw !== undefined) {
324
+ var known = fmtRaw === 'decimal' ||
325
+ fmtRaw === 'upperRoman' ||
326
+ fmtRaw === 'lowerRoman' ||
327
+ fmtRaw === 'upperLetter' ||
328
+ fmtRaw === 'lowerLetter' ||
329
+ fmtRaw === 'ordinal' ||
330
+ fmtRaw === 'cardinalText' ||
331
+ fmtRaw === 'ordinalText' ||
332
+ fmtRaw === 'numberInDash' ||
333
+ fmtRaw === 'chicago';
334
+ if (!known) {
335
+ return undefined;
336
+ }
337
+ }
338
+ var pageNumberStyle = pageNumberStyleFromWire(fmtRaw);
339
+ var pageStartingNumber;
340
+ var restartPageNumbering;
341
+ var startRaw = wmlAttribute(element, 'start');
342
+ if (startRaw !== undefined) {
343
+ if (!/^\d+$/.test(startRaw)) {
344
+ return undefined;
345
+ }
346
+ var startAt = Number.parseInt(startRaw, 10);
347
+ if (startAt < 1) {
348
+ return undefined;
349
+ }
350
+ pageStartingNumber = startAt;
351
+ restartPageNumbering = true;
352
+ }
353
+ var chapStyleRaw = wmlAttribute(element, 'chapStyle');
354
+ var chapSepRaw = wmlAttribute(element, 'chapSep');
355
+ var chapterNumbering;
356
+ if (chapStyleRaw !== undefined) {
357
+ if (!/^\d+$/.test(chapStyleRaw)) {
358
+ return undefined;
359
+ }
360
+ var headingLevel = Number.parseInt(chapStyleRaw, 10);
361
+ if (headingLevel < 1 || headingLevel > 9) {
362
+ return undefined;
363
+ }
364
+ var separator = 'hyphen';
365
+ if (chapSepRaw !== undefined) {
366
+ var parsedSep = parseChapterSeparator(chapSepRaw);
367
+ if (parsedSep === undefined) {
368
+ return undefined;
369
+ }
370
+ separator = parsedSep;
371
+ }
372
+ chapterNumbering = { headingLevel: headingLevel, separator: separator };
373
+ }
374
+ else if (chapSepRaw !== undefined) {
375
+ // chapSep without chapStyle is not meaningful; keep opaque.
376
+ return undefined;
377
+ }
378
+ return {
379
+ pageStartingNumber: pageStartingNumber,
380
+ restartPageNumbering: restartPageNumbering,
381
+ pageNumberStyle: pageNumberStyle,
382
+ chapterNumbering: chapterNumbering,
383
+ pageNumberingPresent: true,
384
+ };
385
+ }
386
+ function isActiveBorderEdge(edge) {
387
+ return edge !== undefined && edge.style !== 'none' && edge.style !== 'nil';
388
+ }
389
+ function parsePageBorderEdge(element) {
390
+ var __ts33_4, __ts33_5;
391
+ var styleRaw = ((__ts33_4 = wValAttribute(element)), __ts33_4 != null
392
+ ? __ts33_4
393
+ : wmlAttribute(element, 'val'));
394
+ if (styleRaw === undefined || !PAGE_BORDER_STYLES.has(styleRaw)) {
395
+ return undefined;
396
+ }
397
+ var style = styleRaw;
398
+ var szRaw = wmlAttribute(element, 'sz');
399
+ var widthPoints = 0.5;
400
+ if (szRaw !== undefined) {
401
+ if (!/^\d+$/.test(szRaw)) {
402
+ return undefined;
403
+ }
404
+ var eighths = Number.parseInt(szRaw, 10);
405
+ widthPoints = eighths / 8;
406
+ if (widthPoints < 0.25 || widthPoints > 12) {
407
+ return undefined;
408
+ }
409
+ }
410
+ var spaceRaw = wmlAttribute(element, 'space');
411
+ var offsetPoints = 0;
412
+ if (spaceRaw !== undefined) {
413
+ if (!/^\d+$/.test(spaceRaw)) {
414
+ return undefined;
415
+ }
416
+ offsetPoints = Number.parseInt(spaceRaw, 10);
417
+ if (offsetPoints < 0 || offsetPoints > 31) {
418
+ return undefined;
419
+ }
420
+ }
421
+ var color = ((__ts33_5 = wmlAttribute(element, 'color')), __ts33_5 != null
422
+ ? __ts33_5
423
+ : 'auto');
424
+ return { style: style, widthPoints: widthPoints, offsetPoints: offsetPoints, color: color };
425
+ }
426
+ function parsePageBorders(element) {
427
+ var e_1, _a;
428
+ var displayRaw = wmlAttribute(element, 'display');
429
+ var applyTo = 'allPages';
430
+ if (displayRaw !== undefined) {
431
+ if (displayRaw !== 'allPages' &&
432
+ displayRaw !== 'firstPage' &&
433
+ displayRaw !== 'notFirstPage') {
434
+ return undefined;
435
+ }
436
+ applyTo = displayRaw;
437
+ }
438
+ var offsetRaw = wmlAttribute(element, 'offsetFrom');
439
+ var measureFrom = 'text';
440
+ if (offsetRaw !== undefined) {
441
+ if (offsetRaw !== 'text' && offsetRaw !== 'page') {
442
+ return undefined;
443
+ }
444
+ measureFrom = offsetRaw;
445
+ }
446
+ var zRaw = wmlAttribute(element, 'zOrder');
447
+ var zOrder = 'front';
448
+ if (zRaw !== undefined) {
449
+ if (zRaw !== 'front' && zRaw !== 'back') {
450
+ return undefined;
451
+ }
452
+ zOrder = zRaw;
453
+ }
454
+ var top;
455
+ var left;
456
+ var bottom;
457
+ var right;
458
+ try {
459
+ for (var _b = __values(elementChildren(element)), _c = _b.next(); !_c.done; _c = _b.next()) {
460
+ var child = _c.value;
461
+ if (isWml(child, 'top')) {
462
+ top = parsePageBorderEdge(child);
463
+ if (top === undefined) {
464
+ return undefined;
465
+ }
466
+ continue;
467
+ }
468
+ if (isWml(child, 'left')) {
469
+ left = parsePageBorderEdge(child);
470
+ if (left === undefined) {
471
+ return undefined;
472
+ }
473
+ continue;
474
+ }
475
+ if (isWml(child, 'bottom')) {
476
+ bottom = parsePageBorderEdge(child);
477
+ if (bottom === undefined) {
478
+ return undefined;
479
+ }
480
+ continue;
481
+ }
482
+ if (isWml(child, 'right')) {
483
+ right = parsePageBorderEdge(child);
484
+ if (right === undefined) {
485
+ return undefined;
486
+ }
487
+ continue;
488
+ }
489
+ // Unmodeled child (e.g. tl2br) → keep whole element opaque
490
+ return undefined;
491
+ }
492
+ }
493
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
494
+ finally {
495
+ try {
496
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
497
+ }
498
+ finally { if (e_1) throw e_1.error; }
499
+ }
500
+ return { applyTo: applyTo, measureFrom: measureFrom, zOrder: zOrder, top: top, left: left, bottom: bottom, right: right };
501
+ }
502
+ function parseVerticalAlignment(element) {
503
+ var val = wValAttribute(element);
504
+ if (val === 'top' || val === 'center' || val === 'both' || val === 'bottom') {
505
+ return val;
506
+ }
507
+ return undefined;
508
+ }
509
+ /**
510
+ * Parse `w:sectPr` into a live {@link PageSetup}.
511
+ *
512
+ * @private
513
+ */
514
+ export function parseSectionProperties(element) {
515
+ var e_2, _a;
516
+ if (element === undefined || !isWml(element, 'sectPr')) {
517
+ return undefined;
518
+ }
519
+ var prefix = [];
520
+ var suffix = [];
521
+ var headerFooterReferences = [];
522
+ var breakCode;
523
+ var pageWidth;
524
+ var pageHeight;
525
+ var orientation;
526
+ var marginLeft;
527
+ var marginTop;
528
+ var marginRight;
529
+ var marginBottom;
530
+ var headerDistance;
531
+ var footerDistance;
532
+ var gutter;
533
+ var paperSource;
534
+ var pageBorders;
535
+ var lineNumbering;
536
+ var pageStartingNumber;
537
+ var restartPageNumbering;
538
+ var pageNumberStyle;
539
+ var chapterNumbering;
540
+ var pageNumberingPresent;
541
+ var columns;
542
+ var verticalAlignment;
543
+ var bidi;
544
+ var differentFirstPage = false;
545
+ var seenModeled = false;
546
+ try {
547
+ for (var _b = __values(elementChildren(element)), _c = _b.next(); !_c.done; _c = _b.next()) {
548
+ var child = _c.value;
549
+ var ref = parseHeaderFooterReference(child);
550
+ if (ref !== undefined) {
551
+ headerFooterReferences.push(ref);
552
+ continue;
553
+ }
554
+ if (isWml(child, 'type') && breakCode === undefined) {
555
+ var parsed = parseSectionMarkWire(child);
556
+ if (parsed !== undefined) {
557
+ breakCode = wireToBreakCode(parsed === 'newPage' ? undefined : parsed);
558
+ seenModeled = true;
559
+ continue;
560
+ }
561
+ if (!seenModeled) {
562
+ prefix.push(child);
563
+ }
564
+ else {
565
+ suffix.push(child);
566
+ }
567
+ continue;
568
+ }
569
+ if (isWml(child, 'pgSz') && pageWidth === undefined) {
570
+ var parsed = parsePageSizeFields(child);
571
+ if (parsed !== undefined) {
572
+ pageWidth = parsed.width;
573
+ pageHeight = parsed.height;
574
+ orientation = parsed.orientation;
575
+ seenModeled = true;
576
+ continue;
577
+ }
578
+ if (!seenModeled) {
579
+ prefix.push(child);
580
+ }
581
+ else {
582
+ suffix.push(child);
583
+ }
584
+ continue;
585
+ }
586
+ if (isWml(child, 'pgMar') && marginLeft === undefined) {
587
+ var parsed = parsePageMarginFields(child);
588
+ if (parsed !== undefined) {
589
+ marginLeft = parsed.left;
590
+ marginTop = parsed.top;
591
+ marginRight = parsed.right;
592
+ marginBottom = parsed.bottom;
593
+ headerDistance = parsed.header;
594
+ footerDistance = parsed.footer;
595
+ gutter = parsed.gutter;
596
+ seenModeled = true;
597
+ continue;
598
+ }
599
+ if (!seenModeled) {
600
+ prefix.push(child);
601
+ }
602
+ else {
603
+ suffix.push(child);
604
+ }
605
+ continue;
606
+ }
607
+ if (isWml(child, 'paperSrc') && paperSource === undefined) {
608
+ var parsed = parsePaperSource(child);
609
+ if (parsed !== undefined) {
610
+ paperSource = parsed;
611
+ seenModeled = true;
612
+ continue;
613
+ }
614
+ if (!seenModeled) {
615
+ prefix.push(child);
616
+ }
617
+ else {
618
+ suffix.push(child);
619
+ }
620
+ continue;
621
+ }
622
+ if (isWml(child, 'pgBorders') && pageBorders === undefined) {
623
+ var parsed = parsePageBorders(child);
624
+ if (parsed !== undefined) {
625
+ pageBorders = parsed;
626
+ seenModeled = true;
627
+ continue;
628
+ }
629
+ if (!seenModeled) {
630
+ prefix.push(child);
631
+ }
632
+ else {
633
+ suffix.push(child);
634
+ }
635
+ continue;
636
+ }
637
+ if (isWml(child, 'lnNumType') && lineNumbering === undefined) {
638
+ var parsed = parseLineNumbering(child);
639
+ if (parsed !== undefined) {
640
+ lineNumbering = parsed;
641
+ seenModeled = true;
642
+ continue;
643
+ }
644
+ if (!seenModeled) {
645
+ prefix.push(child);
646
+ }
647
+ else {
648
+ suffix.push(child);
649
+ }
650
+ continue;
651
+ }
652
+ if (isWml(child, 'pgNumType') && pageNumberingPresent === undefined) {
653
+ var parsed = parsePageNumberingFields(child);
654
+ if (parsed !== undefined) {
655
+ pageStartingNumber = parsed.pageStartingNumber;
656
+ restartPageNumbering = parsed.restartPageNumbering;
657
+ pageNumberStyle = parsed.pageNumberStyle;
658
+ chapterNumbering = parsed.chapterNumbering;
659
+ pageNumberingPresent = true;
660
+ seenModeled = true;
661
+ continue;
662
+ }
663
+ if (!seenModeled) {
664
+ prefix.push(child);
665
+ }
666
+ else {
667
+ suffix.push(child);
668
+ }
669
+ continue;
670
+ }
671
+ if (isWml(child, 'cols') && columns === undefined) {
672
+ var parsed = parseTextColumns(child);
673
+ if (parsed !== undefined) {
674
+ columns = parsed;
675
+ seenModeled = true;
676
+ continue;
677
+ }
678
+ // default single-column or failed parse of known empty defaults
679
+ var numRaw = wmlAttribute(child, 'num');
680
+ var spaceRaw = wmlAttribute(child, 'space');
681
+ var equalRaw = wmlAttribute(child, 'equalWidth');
682
+ var sepRaw = wmlAttribute(child, 'sep');
683
+ var looksDefault = (numRaw === undefined || numRaw === '1') &&
684
+ (spaceRaw === undefined ||
685
+ spaceRaw === String(pointToTwips(DEFAULT_COLUMN_SPACE))) &&
686
+ (equalRaw === undefined || parseOnOffAttribute(equalRaw) === true) &&
687
+ (sepRaw === undefined || parseOnOffAttribute(sepRaw) === false) &&
688
+ elementChildren(child).length === 0;
689
+ if (looksDefault) {
690
+ seenModeled = true;
691
+ continue;
692
+ }
693
+ if (!seenModeled) {
694
+ prefix.push(child);
695
+ }
696
+ else {
697
+ suffix.push(child);
698
+ }
699
+ continue;
700
+ }
701
+ if (isWml(child, 'vAlign') && verticalAlignment === undefined) {
702
+ var parsed = parseVerticalAlignment(child);
703
+ if (parsed !== undefined) {
704
+ verticalAlignment = parsed === 'top' ? undefined : parsed;
705
+ seenModeled = true;
706
+ continue;
707
+ }
708
+ if (!seenModeled) {
709
+ prefix.push(child);
710
+ }
711
+ else {
712
+ suffix.push(child);
713
+ }
714
+ continue;
715
+ }
716
+ if (isWml(child, 'bidi') && bidi === undefined) {
717
+ var flag = parseOnOff(child);
718
+ if (flag === true || flag === false) {
719
+ bidi = flag === true;
720
+ seenModeled = true;
721
+ continue;
722
+ }
723
+ if (!seenModeled) {
724
+ prefix.push(child);
725
+ }
726
+ else {
727
+ suffix.push(child);
728
+ }
729
+ continue;
730
+ }
731
+ if (isWml(child, 'titlePg')) {
732
+ var flag = parseOnOff(child);
733
+ if (flag === true) {
734
+ differentFirstPage = true;
735
+ seenModeled = true;
736
+ continue;
737
+ }
738
+ if (flag === false) {
739
+ differentFirstPage = false;
740
+ seenModeled = true;
741
+ continue;
742
+ }
743
+ if (!seenModeled) {
744
+ prefix.push(child);
745
+ }
746
+ else {
747
+ suffix.push(child);
748
+ }
749
+ continue;
750
+ }
751
+ if (!seenModeled) {
752
+ prefix.push(child);
753
+ }
754
+ else {
755
+ suffix.push(child);
756
+ }
757
+ }
758
+ }
759
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
760
+ finally {
761
+ try {
762
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
763
+ }
764
+ finally { if (e_2) throw e_2.error; }
765
+ }
766
+ return PageSetup.createFromParsedValues({
767
+ attributes: element.attributes,
768
+ prefix: prefix,
769
+ suffix: suffix,
770
+ headerFooterReferences: headerFooterReferences,
771
+ breakCode: breakCode,
772
+ pageWidth: pageWidth !== undefined ? pageWidth : LETTER_WIDTH,
773
+ pageHeight: pageHeight !== undefined ? pageHeight : LETTER_HEIGHT,
774
+ orientation: orientation,
775
+ marginLeft: marginLeft !== undefined ? marginLeft : DEFAULT_MARGIN,
776
+ marginTop: marginTop !== undefined ? marginTop : DEFAULT_MARGIN,
777
+ marginRight: marginRight !== undefined ? marginRight : DEFAULT_MARGIN,
778
+ marginBottom: marginBottom !== undefined ? marginBottom : DEFAULT_MARGIN,
779
+ headerDistance: headerDistance !== undefined
780
+ ? headerDistance
781
+ : DEFAULT_HEADER_FOOTER_DISTANCE,
782
+ footerDistance: footerDistance !== undefined
783
+ ? footerDistance
784
+ : DEFAULT_HEADER_FOOTER_DISTANCE,
785
+ gutter: gutter !== undefined ? gutter : DEFAULT_GUTTER,
786
+ paperSource: paperSource,
787
+ pageBorders: pageBorders,
788
+ lineNumbering: lineNumbering,
789
+ pageStartingNumber: pageStartingNumber,
790
+ restartPageNumbering: restartPageNumbering,
791
+ pageNumberStyle: pageNumberStyle,
792
+ chapterNumbering: chapterNumbering,
793
+ pageNumberingPresent: pageNumberingPresent,
794
+ columns: columns,
795
+ verticalAlignment: verticalAlignment,
796
+ bidi: bidi,
797
+ differentFirstPage: differentFirstPage,
798
+ });
799
+ }
800
+ /**
801
+ * Enable line numbering on every line (`w:lnNumType/@w:countBy="1"`).
802
+ *
803
+ * Sets {@link PageSetup.lineNumberingStep} to `1` (and marks line numbering present).
804
+ *
805
+ * @private
806
+ */
807
+ export function everyLineNumbers(setup) {
808
+ setup.lineNumberingStep = 1;
809
+ }
810
+ /**
811
+ * `true` when the section has no explicit reference for the target slot (inherits).
812
+ *
813
+ * @private
814
+ */
815
+ export function inheritsFromPrevious(section, target) {
816
+ return section.headerFooterReferenceId(target) === undefined;
817
+ }
818
+ /**
819
+ * Stop inheriting a header/footer slot by creating an empty part and reference.
820
+ * Requires the headers-footers feature and a document-associated page setup.
821
+ *
822
+ * @private
823
+ */
824
+ export function unlinkFromPrevious(section, target) {
825
+ return __awaiter(this, void 0, void 0, function () {
826
+ var document, hf;
827
+ return __generator(this, function (_a) {
828
+ if (!isFeatureRegistered(HEADERS_FOOTERS_FEATURE_ID)) {
829
+ throw sectionsError('unlinkFromPrevious requires the headers-footers feature (import @syncfusion/ej2-docx/headers-footers)');
830
+ }
831
+ document = ownerDocumentOf(section);
832
+ if (document === undefined) {
833
+ throw sectionsError('unlinkFromPrevious requires section properties associated with a document');
834
+ }
835
+ hf = require('../headers-footers/index');
836
+ if (target.kind === 'header') {
837
+ hf.setSectionHeader(document, section, '', target.refType);
838
+ }
839
+ else {
840
+ hf.setSectionFooter(document, section, '', target.refType);
841
+ }
842
+ return [2 /*return*/];
843
+ });
844
+ });
845
+ }
846
+ var registered = false;
847
+ /** Original `WordDocument.create` before sections feature wraps it. */
848
+ var originalDocumentCreate;
849
+ /**
850
+ * Seed a live default letter {@link PageSetup} on every new document
851
+ * while the sections feature is registered.
852
+ */
853
+ function wrapDocumentCreate() {
854
+ if (originalDocumentCreate !== undefined) {
855
+ return;
856
+ }
857
+ originalDocumentCreate = WordDocument.create.bind(WordDocument);
858
+ WordDocument.create = function () {
859
+ var document = originalDocumentCreate();
860
+ var props = defaultLetterPageSetup();
861
+ associatePageSetupDocument(props, document);
862
+ document.replaceFinalSectionPropertiesModel(props);
863
+ return document;
864
+ };
865
+ }
866
+ function unwrapDocumentCreate() {
867
+ if (originalDocumentCreate === undefined) {
868
+ return;
869
+ }
870
+ WordDocument.create = originalDocumentCreate;
871
+ originalDocumentCreate = undefined;
872
+ }
873
+ function requirePageSetup(section) {
874
+ var model = section.pageSetup;
875
+ if (model instanceof PageSetup) {
876
+ return model;
877
+ }
878
+ var seeded = defaultLetterPageSetup();
879
+ var document = section.owningDocument();
880
+ associatePageSetupDocument(seeded, document);
881
+ section.setPageSetup(seeded);
882
+ return seeded;
883
+ }
884
+ function installSectionPageSetupAccessors() {
885
+ var proto = Section.prototype;
886
+ Object.defineProperty(proto, 'breakCode', {
887
+ configurable: true,
888
+ enumerable: true,
889
+ get: function () {
890
+ return requirePageSetup(this).breakCode;
891
+ },
892
+ set: function (value) {
893
+ requirePageSetup(this).breakCode = value;
894
+ },
895
+ });
896
+ Object.defineProperty(proto, 'columns', {
897
+ configurable: true,
898
+ enumerable: true,
899
+ get: function () {
900
+ return requirePageSetup(this).columns;
901
+ },
902
+ });
903
+ Object.defineProperty(proto, 'addColumn', {
904
+ configurable: true,
905
+ enumerable: false,
906
+ writable: true,
907
+ value: function addColumn(width, spacing) {
908
+ return requirePageSetup(this).columns.add(width, spacing);
909
+ },
910
+ });
911
+ }
912
+ /**
913
+ * @private
914
+ * Test hook
915
+ */
916
+ export function resetSectionsFeatureForTests() {
917
+ registered = false;
918
+ unwrapDocumentCreate();
919
+ resetSectionPageSetupCloneForTests();
920
+ resetSectionPageSetupSeedForTests();
921
+ resetSectionPropertiesParseForTests();
922
+ resetSectionPropertiesAttachedForTests();
923
+ try {
924
+ // Allow re-install of the public sectionBreak facade on next register.
925
+ delete Paragraph.prototype.sectionBreak;
926
+ }
927
+ catch (_a) {
928
+ // Ignore non-configurable leftovers in exotic hosts.
929
+ }
930
+ }
931
+ /**
932
+ * Install public `Paragraph.sectionBreak` get/set bridging dual-hold helpers.
933
+ * Idempotent when the accessor is already present.
934
+ */
935
+ function installParagraphSectionBreakFacade() {
936
+ var existing = Object.getOwnPropertyDescriptor(Paragraph.prototype, 'sectionBreak');
937
+ if (existing !== undefined && (existing.get !== undefined || existing.set !== undefined)) {
938
+ return;
939
+ }
940
+ Object.defineProperty(Paragraph.prototype, 'sectionBreak', {
941
+ configurable: true,
942
+ enumerable: true,
943
+ get: function () {
944
+ return paragraphSectionBreak(this);
945
+ },
946
+ set: function (value) {
947
+ setParagraphSectionBreak(this, value);
948
+ },
949
+ });
950
+ }
951
+ /**
952
+ * @private
953
+ * Register the sections feature. Idempotent.
954
+ */
955
+ export function registerSectionsFeature() {
956
+ if (registered) {
957
+ return;
958
+ }
959
+ registered = true;
960
+ registerFeature({ id: SECTIONS });
961
+ wrapDocumentCreate();
962
+ installSectionPageSetupAccessors();
963
+ installParagraphSectionBreakFacade();
964
+ registerSectionPropertiesParse(function (element) { return parseSectionProperties(element); });
965
+ registerSectionPropertiesAttached(function (model, document) {
966
+ if (model instanceof PageSetup) {
967
+ associatePageSetupDocument(model, document);
968
+ }
969
+ });
970
+ registerSectionPageSetupClone(function (source) {
971
+ if (!(source instanceof PageSetup)) {
972
+ throw new TypeError('Expected PageSetup');
973
+ }
974
+ return source.cloneDeep();
975
+ });
976
+ registerSectionPageSetupSeed(function () { return defaultLetterPageSetup(); });
977
+ }
978
+ function isPageSetupModel(value) {
979
+ return value instanceof PageSetup;
980
+ }
981
+ /**
982
+ * Ensure body-final section properties are held as a live {@link PageSetup}
983
+ * object (parse once from preserved OOXML when needed).
984
+ */
985
+ function ensureFinalSectionModel(document) {
986
+ var held = document.finalSectionPropertiesModel();
987
+ if (isPageSetupModel(held)) {
988
+ associatePageSetupDocument(held, document);
989
+ return held;
990
+ }
991
+ var raw = document.bodySectPr();
992
+ if (raw === undefined) {
993
+ return undefined;
994
+ }
995
+ var props = parseSectionProperties(raw);
996
+ if (props === undefined) {
997
+ return undefined;
998
+ }
999
+ associatePageSetupDocument(props, document);
1000
+ document.replaceFinalSectionPropertiesModel(props);
1001
+ return props;
1002
+ }
1003
+ /**
1004
+ * Ensure paragraph section-break properties are held as a live object when present.
1005
+ */
1006
+ function ensureParagraphSectionBreakModel(paragraph) {
1007
+ var held = paragraph.sectionBreakPropertiesModel();
1008
+ if (isPageSetupModel(held)) {
1009
+ associatePageSetupDocument(held, paragraph.owningDocument());
1010
+ return held;
1011
+ }
1012
+ var raw = paragraph.sectionBreakSectPr();
1013
+ if (raw === undefined) {
1014
+ return undefined;
1015
+ }
1016
+ var props = parseSectionProperties(raw);
1017
+ if (props === undefined) {
1018
+ return undefined;
1019
+ }
1020
+ associatePageSetupDocument(props, paragraph.owningDocument());
1021
+ paragraph.replaceSectionBreakPropertiesModel(props);
1022
+ return props;
1023
+ }
1024
+ /**
1025
+ * Body-final section properties (`w:body/w:sectPr`).
1026
+ *
1027
+ * Returns the same object identity across calls once materialised.
1028
+ *
1029
+ * @private
1030
+ */
1031
+ export function finalSection(document) {
1032
+ return ensureFinalSectionModel(document);
1033
+ }
1034
+ /**
1035
+ * Replace body-final section properties.
1036
+ *
1037
+ * @private
1038
+ */
1039
+ export function setFinalSection(document, properties) {
1040
+ associatePageSetupDocument(properties, document);
1041
+ document.replaceFinalSectionPropertiesModel(properties);
1042
+ }
1043
+ /**
1044
+ * Paragraph section-break properties (`w:pPr/w:sectPr`), when present.
1045
+ *
1046
+ * Returns the same object identity across calls once materialised.
1047
+ *
1048
+ * @private
1049
+ */
1050
+ export function paragraphSectionBreak(paragraph) {
1051
+ return ensureParagraphSectionBreakModel(paragraph);
1052
+ }
1053
+ /**
1054
+ * Set or clear paragraph section-break properties (`w:pPr/w:sectPr`).
1055
+ *
1056
+ * After dual-hold update, repartitions {@link Document.sections} so non-final
1057
+ * pageSetup lives on its own section and flatten emits mid-body + body-final
1058
+ * `w:sectPr` (TASK-8075/8076 authoring path).
1059
+ *
1060
+ * @private
1061
+ */
1062
+ export function setParagraphSectionBreak(paragraph, properties) {
1063
+ var document = paragraph.owningDocument();
1064
+ if (properties !== undefined) {
1065
+ associatePageSetupDocument(properties, document);
1066
+ paragraph.replaceSectionBreakPropertiesModel(properties);
1067
+ }
1068
+ else {
1069
+ paragraph.replaceSectionBreakPropertiesModel(undefined);
1070
+ paragraph.replaceSectionBreakSectPr(undefined);
1071
+ }
1072
+ // Rebuild Document.sections so dual-hold authoring matches load partition
1073
+ // (non-final pageSetup on its own section; flatten emits mid-body sectPr).
1074
+ document.repartitionFromBodyBlocks();
1075
+ }
1076
+ /**
1077
+ * Body-final properties for internal authoring bridges. Seeds a default letter
1078
+ * page setup when none is present so flatten/serialize always has live
1079
+ * {@link PageSetup} while the sections feature is registered.
1080
+ *
1081
+ * @private
1082
+ */
1083
+ export function ensureFinalSectionProperties(document) {
1084
+ var existing = ensureFinalSectionModel(document);
1085
+ if (existing !== undefined) {
1086
+ return existing;
1087
+ }
1088
+ var seeded = defaultLetterPageSetup();
1089
+ associatePageSetupDocument(seeded, document);
1090
+ document.replaceFinalSectionPropertiesModel(seeded);
1091
+ return seeded;
1092
+ }
1093
+ registerAlwaysOnBodyFeatureBootstrap(function () {
1094
+ registerSectionsFeature();
1095
+ });
1096
+ registerSectionsFeature();