@beyondwork/docx-react-component 1.0.29 → 1.0.30

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 (381) hide show
  1. package/package.json +65 -96
  2. package/src/README.md +85 -0
  3. package/src/api/README.md +26 -0
  4. package/src/api/public-types.ts +1952 -0
  5. package/src/api/session-state.ts +62 -0
  6. package/src/compare/diff-engine.ts +623 -0
  7. package/src/compare/export-redlines.ts +280 -0
  8. package/src/compare/index.ts +25 -0
  9. package/src/compare/snapshot.ts +97 -0
  10. package/src/component-inventory.md +99 -0
  11. package/src/core/README.md +10 -0
  12. package/src/core/commands/README.md +3 -0
  13. package/{dist/chunk-TJBP2K4T.js → src/core/commands/formatting-commands.ts} +536 -196
  14. package/src/core/commands/image-commands.ts +373 -0
  15. package/src/core/commands/index.ts +1879 -0
  16. package/src/core/commands/list-commands.ts +565 -0
  17. package/src/core/commands/paragraph-layout-commands.ts +339 -0
  18. package/src/core/commands/review-commands.ts +108 -0
  19. package/{dist/core/commands/section-layout-commands.cjs → src/core/commands/section-layout-commands.ts} +340 -137
  20. package/src/core/commands/structural-helpers.ts +309 -0
  21. package/{dist/core/commands/style-commands.cjs → src/core/commands/style-commands.ts} +113 -65
  22. package/src/core/commands/table-structure-commands.ts +854 -0
  23. package/{dist/chunk-UZXBISGO.js → src/core/commands/text-commands.ts} +142 -86
  24. package/src/core/schema/README.md +3 -0
  25. package/src/core/schema/text-schema.ts +516 -0
  26. package/src/core/search/search-text.ts +357 -0
  27. package/src/core/selection/README.md +3 -0
  28. package/src/core/selection/mapping.ts +289 -0
  29. package/src/core/selection/review-anchors.ts +183 -0
  30. package/src/core/state/README.md +3 -0
  31. package/src/core/state/editor-state.ts +892 -0
  32. package/src/core/state/text-transaction.ts +869 -0
  33. package/src/formats/xlsx/io/parse-shared-strings.ts +41 -0
  34. package/src/formats/xlsx/io/parse-sheet.ts +459 -0
  35. package/src/formats/xlsx/io/parse-styles.ts +59 -0
  36. package/src/formats/xlsx/io/parse-workbook.ts +75 -0
  37. package/src/formats/xlsx/io/serialize-shared-strings.ts +72 -0
  38. package/src/formats/xlsx/io/serialize-sheet.ts +333 -0
  39. package/src/formats/xlsx/io/serialize-styles.ts +98 -0
  40. package/src/formats/xlsx/io/serialize-workbook.ts +429 -0
  41. package/src/formats/xlsx/io/xlsx-session.ts +314 -0
  42. package/src/formats/xlsx/model/cell.ts +189 -0
  43. package/src/formats/xlsx/model/sheet.ts +326 -0
  44. package/src/formats/xlsx/model/styles.ts +118 -0
  45. package/src/formats/xlsx/model/workbook.ts +453 -0
  46. package/src/formats/xlsx/runtime/cell-commands.ts +567 -0
  47. package/src/formats/xlsx/runtime/sheet-commands.ts +206 -0
  48. package/src/formats/xlsx/runtime/workbook-runtime.ts +177 -0
  49. package/src/formats/xlsx/runtime/workbook-transaction.ts +822 -0
  50. package/src/index.ts +142 -0
  51. package/src/io/README.md +10 -0
  52. package/src/io/docx-session.ts +3175 -0
  53. package/src/io/export/README.md +3 -0
  54. package/src/io/export/export-session.ts +220 -0
  55. package/src/io/export/minimal-docx.ts +115 -0
  56. package/src/io/export/reattach-preserved-parts.ts +54 -0
  57. package/src/io/export/serialize-comments.ts +947 -0
  58. package/src/io/export/serialize-footnotes.ts +394 -0
  59. package/src/io/export/serialize-headers-footers.ts +368 -0
  60. package/src/io/export/serialize-main-document.ts +1342 -0
  61. package/src/io/export/serialize-numbering.ts +218 -0
  62. package/src/io/export/serialize-revisions.ts +389 -0
  63. package/src/io/export/serialize-runtime-revisions.ts +463 -0
  64. package/src/io/export/serialize-tables.ts +174 -0
  65. package/src/io/export/split-review-boundaries.ts +356 -0
  66. package/src/io/export/split-story-blocks-for-runtime-revisions.ts +252 -0
  67. package/src/io/export/table-properties-xml.ts +318 -0
  68. package/src/io/normalize/README.md +3 -0
  69. package/src/io/normalize/normalize-text.ts +670 -0
  70. package/src/io/ooxml/README.md +3 -0
  71. package/src/io/ooxml/highlight-colors.ts +39 -0
  72. package/src/io/ooxml/numbering-sentinels.ts +44 -0
  73. package/src/io/ooxml/parse-comments.ts +852 -0
  74. package/src/io/ooxml/parse-complex-content.ts +287 -0
  75. package/src/io/ooxml/parse-fields.ts +834 -0
  76. package/src/io/ooxml/parse-footnotes.ts +952 -0
  77. package/src/io/ooxml/parse-headers-footers.ts +1212 -0
  78. package/src/io/ooxml/parse-inline-media.ts +461 -0
  79. package/src/io/ooxml/parse-main-document.ts +2947 -0
  80. package/src/io/ooxml/parse-numbering.ts +747 -0
  81. package/src/io/ooxml/parse-revisions.ts +1045 -0
  82. package/src/io/ooxml/parse-settings.ts +184 -0
  83. package/src/io/ooxml/parse-shapes.ts +296 -0
  84. package/src/io/ooxml/parse-styles.ts +639 -0
  85. package/src/io/ooxml/parse-tables.ts +627 -0
  86. package/src/io/ooxml/parse-theme.ts +346 -0
  87. package/src/io/ooxml/part-manifest.ts +136 -0
  88. package/src/io/ooxml/revision-boundaries.ts +475 -0
  89. package/src/io/ooxml/workflow-payload.ts +544 -0
  90. package/src/io/opc/README.md +3 -0
  91. package/src/io/opc/corrupt-package.ts +166 -0
  92. package/src/io/opc/docx-package.ts +74 -0
  93. package/src/io/opc/package-reader.ts +325 -0
  94. package/src/io/opc/package-writer.ts +273 -0
  95. package/src/io/source-package-provenance.ts +241 -0
  96. package/{dist/chunk-RMH72RZI.js → src/legal/bookmarks.ts} +130 -44
  97. package/src/legal/cross-references.ts +414 -0
  98. package/src/legal/defined-terms.ts +203 -0
  99. package/src/legal/index.ts +32 -0
  100. package/src/legal/signature-blocks.ts +259 -0
  101. package/src/model/README.md +3 -0
  102. package/src/model/canonical-document.ts +2722 -0
  103. package/src/model/cds-1.0.0.ts +212 -0
  104. package/src/model/snapshot.ts +760 -0
  105. package/src/preservation/README.md +3 -0
  106. package/src/preservation/markup-compatibility.ts +48 -0
  107. package/src/preservation/opaque-fragment-store.ts +89 -0
  108. package/src/preservation/opaque-region.ts +233 -0
  109. package/src/preservation/package-preservation.ts +113 -0
  110. package/src/preservation/preserved-part-manifest.ts +56 -0
  111. package/src/preservation/relationship-retention.ts +57 -0
  112. package/src/preservation/store.ts +255 -0
  113. package/src/review/README.md +16 -0
  114. package/src/review/store/README.md +3 -0
  115. package/src/review/store/comment-anchors.ts +70 -0
  116. package/src/review/store/comment-remapping.ts +154 -0
  117. package/src/review/store/comment-store.ts +349 -0
  118. package/src/review/store/comment-thread.ts +109 -0
  119. package/src/review/store/revision-actions.ts +423 -0
  120. package/src/review/store/revision-store.ts +323 -0
  121. package/src/review/store/revision-types.ts +182 -0
  122. package/src/review/store/runtime-comment-store.ts +43 -0
  123. package/src/runtime/README.md +3 -0
  124. package/src/runtime/ai-action-policy.ts +764 -0
  125. package/src/runtime/context-analytics.ts +824 -0
  126. package/src/runtime/document-layout.ts +332 -0
  127. package/src/runtime/document-locations.ts +521 -0
  128. package/src/runtime/document-navigation.ts +616 -0
  129. package/src/runtime/document-outline.ts +440 -0
  130. package/src/runtime/document-runtime.ts +4055 -0
  131. package/src/runtime/document-search.ts +145 -0
  132. package/src/runtime/event-refresh-hints.ts +137 -0
  133. package/src/runtime/numbering-prefix.ts +244 -0
  134. package/src/runtime/page-layout-estimation.ts +305 -0
  135. package/src/runtime/read-only-diagnostics-runtime.ts +241 -0
  136. package/src/runtime/resolved-numbering-geometry.ts +293 -0
  137. package/src/runtime/review-runtime.ts +44 -0
  138. package/src/runtime/revision-runtime.ts +107 -0
  139. package/src/runtime/session-capabilities.ts +192 -0
  140. package/src/runtime/story-context.ts +164 -0
  141. package/src/runtime/story-targeting.ts +162 -0
  142. package/src/runtime/suggestions-snapshot.ts +137 -0
  143. package/src/runtime/surface-projection.ts +1553 -0
  144. package/src/runtime/table-commands.ts +173 -0
  145. package/src/runtime/table-schema.ts +309 -0
  146. package/src/runtime/table-style-resolver.ts +409 -0
  147. package/src/runtime/view-state.ts +493 -0
  148. package/src/runtime/virtualized-rendering.ts +258 -0
  149. package/src/runtime/workflow-markup.ts +393 -0
  150. package/src/ui/README.md +30 -0
  151. package/src/ui/WordReviewEditor.tsx +5268 -0
  152. package/src/ui/browser-export.ts +52 -0
  153. package/src/ui/comments/README.md +3 -0
  154. package/src/ui/compatibility/README.md +3 -0
  155. package/src/ui/editor-command-bag.ts +127 -0
  156. package/src/ui/editor-runtime-boundary.ts +1558 -0
  157. package/src/ui/editor-shell-view.tsx +144 -0
  158. package/src/ui/editor-surface/README.md +3 -0
  159. package/src/ui/editor-surface-controller.tsx +66 -0
  160. package/src/ui/headless/comment-decoration-model.ts +124 -0
  161. package/src/ui/headless/preserve-editor-selection.ts +5 -0
  162. package/src/ui/headless/revision-decoration-model.ts +128 -0
  163. package/src/ui/headless/selection-helpers.ts +54 -0
  164. package/src/ui/headless/selection-tool-context.ts +19 -0
  165. package/src/ui/headless/selection-tool-resolver.ts +752 -0
  166. package/src/ui/headless/selection-tool-types.ts +129 -0
  167. package/src/ui/headless/selection-toolbar-model.ts +11 -0
  168. package/src/ui/headless/use-editor-keyboard.ts +103 -0
  169. package/src/ui/review/README.md +3 -0
  170. package/src/ui/runtime-shortcut-dispatch.ts +365 -0
  171. package/src/ui/runtime-snapshot-selectors.ts +197 -0
  172. package/src/ui/shared/revision-filters.ts +31 -0
  173. package/src/ui/status/README.md +3 -0
  174. package/src/ui/theme/README.md +3 -0
  175. package/src/ui/toolbar/README.md +3 -0
  176. package/src/ui/workflow-surface-blocked-rails.ts +94 -0
  177. package/src/ui-tailwind/chrome/chrome-preset-model.ts +107 -0
  178. package/src/ui-tailwind/chrome/chrome-preset-toolbar.tsx +15 -0
  179. package/src/ui-tailwind/chrome/review-queue-bar.tsx +97 -0
  180. package/src/ui-tailwind/chrome/tw-alert-banner.tsx +64 -0
  181. package/src/ui-tailwind/chrome/tw-context-analytics-summary.tsx +122 -0
  182. package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +121 -0
  183. package/src/ui-tailwind/chrome/tw-layout-panel.tsx +114 -0
  184. package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +30 -0
  185. package/src/ui-tailwind/chrome/tw-page-ruler.tsx +365 -0
  186. package/src/ui-tailwind/chrome/tw-selection-tool-blocked.tsx +23 -0
  187. package/src/ui-tailwind/chrome/tw-selection-tool-comment.tsx +35 -0
  188. package/src/ui-tailwind/chrome/tw-selection-tool-formatting.tsx +37 -0
  189. package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +298 -0
  190. package/src/ui-tailwind/chrome/tw-selection-tool-structure.tsx +116 -0
  191. package/src/ui-tailwind/chrome/tw-selection-tool-suggestion.tsx +29 -0
  192. package/src/ui-tailwind/chrome/tw-selection-tool-workflow.tsx +27 -0
  193. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +186 -0
  194. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +139 -0
  195. package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +200 -0
  196. package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +58 -0
  197. package/src/ui-tailwind/chrome/use-before-unload.ts +20 -0
  198. package/src/ui-tailwind/editor-surface/perf-probe.ts +179 -0
  199. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +189 -0
  200. package/src/ui-tailwind/editor-surface/pm-contextual-ui.ts +31 -0
  201. package/src/ui-tailwind/editor-surface/pm-decorations.ts +411 -0
  202. package/src/ui-tailwind/editor-surface/pm-position-map.ts +123 -0
  203. package/src/ui-tailwind/editor-surface/pm-schema.ts +927 -0
  204. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +567 -0
  205. package/src/ui-tailwind/editor-surface/search-plugin.ts +168 -0
  206. package/src/ui-tailwind/editor-surface/surface-build-keys.ts +65 -0
  207. package/src/ui-tailwind/editor-surface/tw-caret.tsx +12 -0
  208. package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +150 -0
  209. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +129 -0
  210. package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +58 -0
  211. package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +151 -0
  212. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +1047 -0
  213. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +111 -0
  214. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +503 -0
  215. package/src/ui-tailwind/index.ts +62 -0
  216. package/src/ui-tailwind/page-chrome-model.ts +27 -0
  217. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +406 -0
  218. package/src/ui-tailwind/review/tw-health-panel.tsx +149 -0
  219. package/src/ui-tailwind/review/tw-review-rail.tsx +122 -0
  220. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +164 -0
  221. package/src/ui-tailwind/status/tw-status-bar.tsx +65 -0
  222. package/{dist → src}/ui-tailwind/theme/editor-theme.css +58 -40
  223. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +52 -0
  224. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +1133 -0
  225. package/src/ui-tailwind/tw-review-workspace.tsx +1460 -0
  226. package/src/validation/README.md +3 -0
  227. package/src/validation/compatibility-engine.ts +878 -0
  228. package/src/validation/compatibility-report.ts +161 -0
  229. package/src/validation/diagnostics.ts +204 -0
  230. package/src/validation/docx-comment-proof.ts +720 -0
  231. package/src/validation/import-diagnostics.ts +128 -0
  232. package/src/validation/low-priority-word-surfaces.ts +373 -0
  233. package/dist/canonical-document-BLEbzL2J.d.cts +0 -844
  234. package/dist/canonical-document-BLEbzL2J.d.ts +0 -844
  235. package/dist/chunk-2FJS5GZM.js +0 -763
  236. package/dist/chunk-2FJS5GZM.js.map +0 -1
  237. package/dist/chunk-2OQBZS3F.js +0 -446
  238. package/dist/chunk-2OQBZS3F.js.map +0 -1
  239. package/dist/chunk-2S7W4KFO.js +0 -127
  240. package/dist/chunk-2S7W4KFO.js.map +0 -1
  241. package/dist/chunk-2TG72QSW.js +0 -3874
  242. package/dist/chunk-2TG72QSW.js.map +0 -1
  243. package/dist/chunk-36QNIZBO.js +0 -532
  244. package/dist/chunk-36QNIZBO.js.map +0 -1
  245. package/dist/chunk-4AQOYAW4.js +0 -3069
  246. package/dist/chunk-4AQOYAW4.js.map +0 -1
  247. package/dist/chunk-4D5EWJ3P.js +0 -77
  248. package/dist/chunk-4D5EWJ3P.js.map +0 -1
  249. package/dist/chunk-5FN54NDH.js +0 -2257
  250. package/dist/chunk-5FN54NDH.js.map +0 -1
  251. package/dist/chunk-BOYGQYRQ.js +0 -7306
  252. package/dist/chunk-BOYGQYRQ.js.map +0 -1
  253. package/dist/chunk-CN3XMECL.js +0 -212
  254. package/dist/chunk-CN3XMECL.js.map +0 -1
  255. package/dist/chunk-EBI3BX6U.js +0 -164
  256. package/dist/chunk-EBI3BX6U.js.map +0 -1
  257. package/dist/chunk-EILUG3VB.js +0 -1275
  258. package/dist/chunk-EILUG3VB.js.map +0 -1
  259. package/dist/chunk-FUDY333O.js +0 -70
  260. package/dist/chunk-FUDY333O.js.map +0 -1
  261. package/dist/chunk-GBVOWFIK.js +0 -1237
  262. package/dist/chunk-GBVOWFIK.js.map +0 -1
  263. package/dist/chunk-H4TQ3H3Y.js +0 -262
  264. package/dist/chunk-H4TQ3H3Y.js.map +0 -1
  265. package/dist/chunk-JGB3IXZO.js +0 -189
  266. package/dist/chunk-JGB3IXZO.js.map +0 -1
  267. package/dist/chunk-KD2QRQPY.js +0 -4342
  268. package/dist/chunk-KD2QRQPY.js.map +0 -1
  269. package/dist/chunk-KLMXQVYK.js +0 -369
  270. package/dist/chunk-KLMXQVYK.js.map +0 -1
  271. package/dist/chunk-KZUG5KFQ.js +0 -214
  272. package/dist/chunk-KZUG5KFQ.js.map +0 -1
  273. package/dist/chunk-QDAQ4CJU.js +0 -345
  274. package/dist/chunk-QDAQ4CJU.js.map +0 -1
  275. package/dist/chunk-RMH72RZI.js.map +0 -1
  276. package/dist/chunk-SWKWQZXM.js +0 -117
  277. package/dist/chunk-SWKWQZXM.js.map +0 -1
  278. package/dist/chunk-TJBP2K4T.js.map +0 -1
  279. package/dist/chunk-TLCEAQDQ.js +0 -542
  280. package/dist/chunk-TLCEAQDQ.js.map +0 -1
  281. package/dist/chunk-UZXBISGO.js.map +0 -1
  282. package/dist/chunk-WGBAKP3Q.js +0 -3220
  283. package/dist/chunk-WGBAKP3Q.js.map +0 -1
  284. package/dist/compare/index.cjs +0 -5475
  285. package/dist/compare/index.cjs.map +0 -1
  286. package/dist/compare/index.d.cts +0 -114
  287. package/dist/compare/index.d.ts +0 -114
  288. package/dist/compare/index.js +0 -731
  289. package/dist/compare/index.js.map +0 -1
  290. package/dist/core/commands/formatting-commands.cjs +0 -828
  291. package/dist/core/commands/formatting-commands.cjs.map +0 -1
  292. package/dist/core/commands/formatting-commands.d.cts +0 -63
  293. package/dist/core/commands/formatting-commands.d.ts +0 -63
  294. package/dist/core/commands/formatting-commands.js +0 -37
  295. package/dist/core/commands/formatting-commands.js.map +0 -1
  296. package/dist/core/commands/image-commands.cjs +0 -2023
  297. package/dist/core/commands/image-commands.cjs.map +0 -1
  298. package/dist/core/commands/image-commands.d.cts +0 -58
  299. package/dist/core/commands/image-commands.d.ts +0 -58
  300. package/dist/core/commands/image-commands.js +0 -18
  301. package/dist/core/commands/image-commands.js.map +0 -1
  302. package/dist/core/commands/section-layout-commands.cjs.map +0 -1
  303. package/dist/core/commands/section-layout-commands.d.cts +0 -62
  304. package/dist/core/commands/section-layout-commands.d.ts +0 -62
  305. package/dist/core/commands/section-layout-commands.js +0 -21
  306. package/dist/core/commands/section-layout-commands.js.map +0 -1
  307. package/dist/core/commands/style-commands.cjs.map +0 -1
  308. package/dist/core/commands/style-commands.d.cts +0 -13
  309. package/dist/core/commands/style-commands.d.ts +0 -13
  310. package/dist/core/commands/style-commands.js +0 -9
  311. package/dist/core/commands/style-commands.js.map +0 -1
  312. package/dist/core/commands/table-structure-commands.cjs +0 -1883
  313. package/dist/core/commands/table-structure-commands.cjs.map +0 -1
  314. package/dist/core/commands/table-structure-commands.d.cts +0 -59
  315. package/dist/core/commands/table-structure-commands.d.ts +0 -59
  316. package/dist/core/commands/table-structure-commands.js +0 -12
  317. package/dist/core/commands/table-structure-commands.js.map +0 -1
  318. package/dist/core/commands/text-commands.cjs +0 -2391
  319. package/dist/core/commands/text-commands.cjs.map +0 -1
  320. package/dist/core/commands/text-commands.d.cts +0 -24
  321. package/dist/core/commands/text-commands.d.ts +0 -24
  322. package/dist/core/commands/text-commands.js +0 -28
  323. package/dist/core/commands/text-commands.js.map +0 -1
  324. package/dist/core/selection/mapping.cjs +0 -200
  325. package/dist/core/selection/mapping.cjs.map +0 -1
  326. package/dist/core/selection/mapping.d.cts +0 -2
  327. package/dist/core/selection/mapping.d.ts +0 -2
  328. package/dist/core/selection/mapping.js +0 -31
  329. package/dist/core/selection/mapping.js.map +0 -1
  330. package/dist/core/state/editor-state.cjs +0 -2278
  331. package/dist/core/state/editor-state.cjs.map +0 -1
  332. package/dist/core/state/editor-state.d.cts +0 -2
  333. package/dist/core/state/editor-state.d.ts +0 -2
  334. package/dist/core/state/editor-state.js +0 -26
  335. package/dist/core/state/editor-state.js.map +0 -1
  336. package/dist/index.cjs +0 -38553
  337. package/dist/index.cjs.map +0 -1
  338. package/dist/index.d.cts +0 -15
  339. package/dist/index.d.ts +0 -15
  340. package/dist/index.js +0 -7856
  341. package/dist/index.js.map +0 -1
  342. package/dist/io/docx-session.cjs +0 -16236
  343. package/dist/io/docx-session.cjs.map +0 -1
  344. package/dist/io/docx-session.d.cts +0 -21
  345. package/dist/io/docx-session.d.ts +0 -21
  346. package/dist/io/docx-session.js +0 -18
  347. package/dist/io/docx-session.js.map +0 -1
  348. package/dist/legal/index.cjs +0 -3900
  349. package/dist/legal/index.cjs.map +0 -1
  350. package/dist/legal/index.d.cts +0 -86
  351. package/dist/legal/index.d.ts +0 -86
  352. package/dist/legal/index.js +0 -616
  353. package/dist/legal/index.js.map +0 -1
  354. package/dist/public-types-7ZL_94cz.d.ts +0 -1573
  355. package/dist/public-types-CeMaDueh.d.cts +0 -1573
  356. package/dist/public-types.cjs +0 -19
  357. package/dist/public-types.cjs.map +0 -1
  358. package/dist/public-types.d.cts +0 -2
  359. package/dist/public-types.d.ts +0 -2
  360. package/dist/public-types.js +0 -1
  361. package/dist/public-types.js.map +0 -1
  362. package/dist/runtime/document-runtime.cjs +0 -11140
  363. package/dist/runtime/document-runtime.cjs.map +0 -1
  364. package/dist/runtime/document-runtime.d.cts +0 -231
  365. package/dist/runtime/document-runtime.d.ts +0 -231
  366. package/dist/runtime/document-runtime.js +0 -21
  367. package/dist/runtime/document-runtime.js.map +0 -1
  368. package/dist/structural-helpers-CilgOVhh.d.cts +0 -10
  369. package/dist/structural-helpers-q0Gd-eBN.d.ts +0 -10
  370. package/dist/ui-tailwind/editor-surface/search-plugin.cjs +0 -313
  371. package/dist/ui-tailwind/editor-surface/search-plugin.cjs.map +0 -1
  372. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +0 -67
  373. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +0 -67
  374. package/dist/ui-tailwind/editor-surface/search-plugin.js +0 -23
  375. package/dist/ui-tailwind/editor-surface/search-plugin.js.map +0 -1
  376. package/dist/ui-tailwind/index.cjs +0 -4833
  377. package/dist/ui-tailwind/index.cjs.map +0 -1
  378. package/dist/ui-tailwind/index.d.cts +0 -617
  379. package/dist/ui-tailwind/index.d.ts +0 -617
  380. package/dist/ui-tailwind/index.js +0 -575
  381. package/dist/ui-tailwind/index.js.map +0 -1
@@ -1,763 +0,0 @@
1
- import {
2
- describeOpaqueFragment,
3
- listOpaqueFragments,
4
- listPreservedPackageParts
5
- } from "./chunk-SWKWQZXM.js";
6
- import {
7
- createRangeAnchor,
8
- mapAnchor,
9
- normalizeRange
10
- } from "./chunk-EBI3BX6U.js";
11
-
12
- // src/api/session-state.ts
13
- var EDITOR_SESSION_STATE_VERSION = "editor-session-state/1";
14
- function cloneStructuredValue(value) {
15
- return structuredClone(value);
16
- }
17
- function createEditorSessionState(input) {
18
- return cloneStructuredValue({
19
- sessionVersion: EDITOR_SESSION_STATE_VERSION,
20
- ...input
21
- });
22
- }
23
- function editorSessionStateFromPersistedSnapshot(snapshot) {
24
- return createEditorSessionState({
25
- schemaVersion: snapshot.schemaVersion,
26
- documentId: snapshot.documentId,
27
- docId: snapshot.docId,
28
- createdAt: snapshot.createdAt,
29
- updatedAt: snapshot.updatedAt,
30
- editorBuild: snapshot.editorBuild,
31
- canonicalDocument: snapshot.canonicalDocument,
32
- compatibility: snapshot.compatibility,
33
- warningLog: snapshot.warningLog,
34
- protectionSnapshot: snapshot.protectionSnapshot,
35
- sourcePackage: snapshot.sourcePackage
36
- });
37
- }
38
- function persistedSnapshotFromEditorSessionState(sessionState, options) {
39
- return cloneStructuredValue({
40
- snapshotVersion: "persisted-editor-snapshot/2",
41
- schemaVersion: sessionState.schemaVersion,
42
- documentId: sessionState.documentId,
43
- docId: sessionState.docId,
44
- createdAt: sessionState.createdAt,
45
- updatedAt: sessionState.updatedAt,
46
- savedAt: options.savedAt,
47
- editorBuild: sessionState.editorBuild,
48
- canonicalDocument: sessionState.canonicalDocument,
49
- compatibility: sessionState.compatibility,
50
- warningLog: sessionState.warningLog,
51
- protectionSnapshot: sessionState.protectionSnapshot,
52
- sourcePackage: sessionState.sourcePackage
53
- });
54
- }
55
-
56
- // src/review/store/revision-types.ts
57
- function createRevisionRangeAnchor(from, to = from, assoc) {
58
- return createRangeAnchor(from, to, assoc);
59
- }
60
- function remapRevisionAnchor(anchor, mapping) {
61
- return mapAnchor(anchor, mapping);
62
- }
63
- function isDetachedRevisionAnchor(anchor) {
64
- return anchor.kind === "detached";
65
- }
66
- function summarizeRevisionAnchor(anchor) {
67
- if (anchor.kind === "range") {
68
- return {
69
- anchor,
70
- state: "active",
71
- range: normalizeRange(anchor.range)
72
- };
73
- }
74
- if (anchor.kind === "node") {
75
- return {
76
- anchor,
77
- state: "active",
78
- range: {
79
- from: anchor.at,
80
- to: anchor.at
81
- }
82
- };
83
- }
84
- return {
85
- anchor,
86
- state: "detached",
87
- range: normalizeRange(anchor.lastKnownRange)
88
- };
89
- }
90
- function getRevisionActionability(revision) {
91
- if (typeof revision !== "string" && typeof revision.metadata.preserveOnlyReason === "string" && revision.metadata.preserveOnlyReason.length > 0) {
92
- return "preserve-only";
93
- }
94
- const kind = typeof revision === "string" ? revision : revision.kind;
95
- switch (kind) {
96
- case "insertion":
97
- case "deletion":
98
- case "property-change":
99
- return "actionable";
100
- case "formatting":
101
- case "move":
102
- return "preserve-only";
103
- }
104
- }
105
- function isRevisionActionable(record) {
106
- return getRevisionActionability(record) === "actionable" && record.status === "active";
107
- }
108
- function describeRevisionKind(kind) {
109
- switch (kind) {
110
- case "insertion":
111
- return "Insertion";
112
- case "deletion":
113
- return "Deletion";
114
- case "formatting":
115
- return "Formatting change";
116
- case "move":
117
- return "Move";
118
- case "property-change":
119
- return "Property change";
120
- }
121
- }
122
-
123
- // src/review/store/revision-store.ts
124
- function createRevisionStore(revisions = {}) {
125
- return {
126
- version: "revision-store/1",
127
- revisions
128
- };
129
- }
130
- function createRevisionRecord(params) {
131
- return normalizeRevisionRecord({
132
- revisionId: params.revisionId,
133
- kind: params.kind,
134
- anchor: params.anchor,
135
- authorId: params.authorId,
136
- createdAt: params.createdAt,
137
- status: params.status ?? "active",
138
- warningIds: [...params.warningIds ?? []],
139
- metadata: {
140
- source: params.metadata?.source ?? "runtime",
141
- storyTarget: params.metadata?.storyTarget,
142
- preserveOnlyReason: params.metadata?.preserveOnlyReason ?? (getRevisionActionability(params.kind) === "preserve-only" ? "Imported preserve-only revision." : void 0),
143
- importedRevisionForm: params.metadata?.importedRevisionForm,
144
- originalRevisionType: params.metadata?.originalRevisionType,
145
- ooxmlRevisionId: params.metadata?.ooxmlRevisionId,
146
- propertyChangeData: params.metadata?.propertyChangeData,
147
- moveData: params.metadata?.moveData
148
- }
149
- });
150
- }
151
- function upsertRevisionRecord(store, revision) {
152
- return {
153
- ...store,
154
- revisions: {
155
- ...store.revisions,
156
- [revision.revisionId]: normalizeRevisionRecord(revision)
157
- }
158
- };
159
- }
160
- function setRevisionStatus(store, revisionId, status) {
161
- const existing = store.revisions[revisionId];
162
- if (!existing) {
163
- return store;
164
- }
165
- if (existing.status === "detached") {
166
- return store;
167
- }
168
- if ((status === "accepted" || status === "rejected") && getRevisionActionability(existing) !== "actionable") {
169
- return store;
170
- }
171
- return upsertRevisionRecord(store, {
172
- ...existing,
173
- status
174
- });
175
- }
176
- function remapRevisionStore(store, mapping) {
177
- return createRevisionStore(
178
- Object.fromEntries(
179
- Object.entries(store.revisions).map(([revisionId, revision]) => {
180
- const anchor = remapRevisionAnchor(revision.anchor, mapping);
181
- const status = anchor.kind === "detached" ? "detached" : revision.status === "accepted" || revision.status === "rejected" ? revision.status : "active";
182
- return [
183
- revisionId,
184
- normalizeRevisionRecord({
185
- ...revision,
186
- anchor,
187
- status
188
- })
189
- ];
190
- })
191
- )
192
- );
193
- }
194
- function createRevisionSidebarProjection(store) {
195
- const revisions = Object.values(store.revisions).map(toSidebarEntry).sort(compareRevisionEntries);
196
- return {
197
- totalCount: revisions.length,
198
- activeRevisionIds: revisions.filter((revision) => revision.status === "active").map((revision) => revision.revisionId),
199
- acceptedRevisionIds: revisions.filter((revision) => revision.status === "accepted").map((revision) => revision.revisionId),
200
- rejectedRevisionIds: revisions.filter((revision) => revision.status === "rejected").map((revision) => revision.revisionId),
201
- detachedRevisionIds: revisions.filter((revision) => revision.status === "detached").map((revision) => revision.revisionId),
202
- actionableRevisionIds: revisions.filter((revision) => revision.actionability === "actionable").map((revision) => revision.revisionId),
203
- preserveOnlyRevisionIds: revisions.filter((revision) => revision.actionability === "preserve-only").map((revision) => revision.revisionId),
204
- revisions
205
- };
206
- }
207
- function toSidebarEntry(revision) {
208
- const anchorSummary = summarizeRevisionAnchor(revision.anchor);
209
- const actionability = getRevisionActionability(revision);
210
- const moveData = revision.metadata.moveData;
211
- return {
212
- revisionId: revision.revisionId,
213
- kind: revision.kind,
214
- label: describeRevisionKind(revision.kind),
215
- status: revision.status,
216
- actionability,
217
- anchorLabel: anchorSummary.state === "detached" ? `Detached ${anchorSummary.range.from}-${anchorSummary.range.to}` : `Range ${anchorSummary.range.from}-${anchorSummary.range.to}`,
218
- createdAt: revision.createdAt,
219
- authorId: revision.authorId,
220
- warningCount: revision.warningIds.length,
221
- canAccept: isRevisionActionable(revision),
222
- canReject: isRevisionActionable(revision),
223
- preserveOnlyReason: revision.metadata.preserveOnlyReason,
224
- linkedMoveRevisionId: moveData?.linkedRevisionId,
225
- moveDirection: moveData?.direction
226
- };
227
- }
228
- function normalizeRevisionRecord(revision) {
229
- const actionability = getRevisionActionability(revision);
230
- if (isDetachedRevisionAnchor(revision.anchor)) {
231
- return {
232
- ...revision,
233
- status: "detached",
234
- metadata: {
235
- ...revision.metadata,
236
- preserveOnlyReason: revision.metadata.preserveOnlyReason ?? (actionability === "preserve-only" ? "Imported preserve-only revision." : void 0)
237
- }
238
- };
239
- }
240
- if (actionability === "preserve-only" && revision.status !== "detached") {
241
- return {
242
- ...revision,
243
- status: revision.status === "accepted" || revision.status === "rejected" ? "active" : revision.status,
244
- metadata: {
245
- ...revision.metadata,
246
- preserveOnlyReason: revision.metadata.preserveOnlyReason ?? "Imported preserve-only revision."
247
- }
248
- };
249
- }
250
- return revision;
251
- }
252
- function compareRevisionEntries(left, right) {
253
- const statusDelta = priorityForStatus(left.status) - priorityForStatus(right.status);
254
- if (statusDelta !== 0) {
255
- return statusDelta;
256
- }
257
- const actionabilityDelta = priorityForActionability(left.actionability) - priorityForActionability(right.actionability);
258
- if (actionabilityDelta !== 0) {
259
- return actionabilityDelta;
260
- }
261
- return left.createdAt.localeCompare(right.createdAt);
262
- }
263
- function priorityForStatus(status) {
264
- switch (status) {
265
- case "active":
266
- return 0;
267
- case "detached":
268
- return 1;
269
- case "accepted":
270
- return 2;
271
- case "rejected":
272
- return 3;
273
- }
274
- }
275
- function priorityForActionability(actionability) {
276
- switch (actionability) {
277
- case "actionable":
278
- return 0;
279
- case "preserve-only":
280
- return 1;
281
- }
282
- }
283
-
284
- // src/validation/compatibility-engine.ts
285
- function buildCompatibilityReport(input) {
286
- const content = normalizeDocumentRoot(input.document.content);
287
- const contentFeatures = collectContentFeatures(content);
288
- if (hasSupportedRuntimeComments(input.document.review.comments)) {
289
- contentFeatures.push(
290
- supportedEntry(
291
- "comments-single-paragraph",
292
- "Single-paragraph review comments stay mappable through runtime selections."
293
- )
294
- );
295
- }
296
- const featureEntries = [
297
- ...contentFeatures,
298
- ...collectPreservationFeatures(input.document)
299
- ];
300
- const warnings = dedupeWarnings([
301
- ...input.warnings ?? [],
302
- ...collectDiagnosticWarnings(input.document)
303
- ]);
304
- const errors = dedupeErrors([
305
- ...collectDiagnosticErrors(input.document),
306
- ...input.fatalError ? [input.fatalError] : []
307
- ]);
308
- return {
309
- reportVersion: "compatibility-report/1",
310
- generatedAt: input.generatedAt,
311
- blockExport: featureEntries.some((entry) => entry.featureClass === "unsupported-fatal") || errors.some((error) => error.isFatal),
312
- featureEntries,
313
- warnings,
314
- errors
315
- };
316
- }
317
- function hasSupportedRuntimeComments(comments) {
318
- return Object.values(comments).some((comment) => comment.anchor.kind !== "detached");
319
- }
320
- function normalizeDocumentRoot(content) {
321
- if (content && typeof content === "object" && content.type === "doc") {
322
- return content;
323
- }
324
- if (Array.isArray(content)) {
325
- return {
326
- type: "doc",
327
- children: content.filter(
328
- (value) => Boolean(value) && typeof value === "object" && (value.type === "paragraph" || value.type === "opaque_block")
329
- )
330
- };
331
- }
332
- return {
333
- type: "doc",
334
- children: [{ type: "paragraph", children: [] }]
335
- };
336
- }
337
- function collectContentFeatures(content) {
338
- const flags = {
339
- paragraphs: false,
340
- runs: false,
341
- whitespace: false,
342
- headings: false,
343
- lists: false,
344
- hyperlinks: false,
345
- images: false,
346
- tables: false,
347
- sections: false,
348
- contentControls: false
349
- };
350
- for (let index = 0; index < content.children.length; index += 1) {
351
- measureBlock(content.children[index], flags);
352
- }
353
- const entries = [];
354
- if (flags.paragraphs) {
355
- entries.push(supportedEntry("paragraphs", "Paragraph structure is editable and round-trippable."));
356
- }
357
- if (flags.runs) {
358
- entries.push(supportedEntry("runs", "Runs and inline text are editable through runtime commands."));
359
- }
360
- if (flags.whitespace) {
361
- entries.push(supportedEntry("whitespace", "Whitespace-sensitive text units stay explicit in the runtime model."));
362
- }
363
- if (flags.headings) {
364
- entries.push(supportedEntry("headings", "Heading styles remain attached to paragraph structure."));
365
- }
366
- if (flags.lists) {
367
- entries.push(supportedEntry("lists", "Numbering metadata stays attached to paragraph blocks."));
368
- }
369
- if (flags.hyperlinks) {
370
- entries.push(supportedEntry("hyperlinks", "Hyperlink relationships are preserved and re-serialized."));
371
- }
372
- if (flags.images) {
373
- entries.push(supportedEntry("inline-images", "Inline image placements stay attached to preserved media parts."));
374
- }
375
- if (flags.tables) {
376
- entries.push(
377
- supportedEntry(
378
- "tables",
379
- "Structured tables keep cell topology and common visual properties through runtime editing and export."
380
- )
381
- );
382
- }
383
- if (flags.sections) {
384
- entries.push(
385
- supportedEntry(
386
- "sections",
387
- "Section boundaries and page-layout properties remain structured and export-safe."
388
- )
389
- );
390
- }
391
- if (flags.contentControls) {
392
- entries.push(
393
- supportedEntry(
394
- "content-controls",
395
- "Common content controls render through structured SDT state and round-trip without flattening to opaque placeholders."
396
- )
397
- );
398
- }
399
- return entries;
400
- }
401
- function measureBlock(block, flags) {
402
- switch (block.type) {
403
- case "paragraph":
404
- flags.paragraphs = true;
405
- if (block.styleId?.toLowerCase().startsWith("heading")) {
406
- flags.headings = true;
407
- }
408
- if (block.numbering) {
409
- flags.lists = true;
410
- }
411
- return measureParagraph(block, flags);
412
- case "table":
413
- flags.tables = true;
414
- return block.rows.reduce(
415
- (size, row) => size + row.cells.reduce(
416
- (cellSize, cell) => cellSize + cell.children.reduce((childSize, child) => childSize + measureBlock(child, flags), 0),
417
- 0
418
- ),
419
- 0
420
- );
421
- case "sdt":
422
- flags.contentControls = true;
423
- return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
424
- case "custom_xml":
425
- return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
426
- case "section_break":
427
- flags.sections = true;
428
- return 1;
429
- default:
430
- return 0;
431
- }
432
- }
433
- function measureParagraph(paragraph, flags) {
434
- let size = 0;
435
- const children = Array.isArray(paragraph.children) ? paragraph.children : [];
436
- for (const child of children) {
437
- size += measureInlineNode(child, flags);
438
- }
439
- return size;
440
- }
441
- function measureInlineNode(node, flags) {
442
- switch (node.type) {
443
- case "text":
444
- flags.runs = flags.runs || node.text.length > 0;
445
- flags.whitespace = flags.whitespace || /^\s/u.test(node.text) || /\s$/u.test(node.text) || node.text.includes(" ");
446
- return Array.from(node.text).length;
447
- case "tab":
448
- case "hard_break":
449
- flags.runs = true;
450
- flags.whitespace = true;
451
- return 1;
452
- case "hyperlink":
453
- flags.runs = true;
454
- flags.hyperlinks = true;
455
- return node.children.reduce((size, child) => size + measureInlineNode(child, flags), 0);
456
- case "image":
457
- flags.images = true;
458
- flags.runs = true;
459
- return 1;
460
- case "opaque_inline":
461
- flags.runs = true;
462
- return 1;
463
- case "column_break":
464
- case "symbol":
465
- case "field":
466
- case "bookmark_start":
467
- case "bookmark_end":
468
- case "footnote_ref":
469
- case "chart_preview":
470
- case "smartart_preview":
471
- case "shape":
472
- case "wordart":
473
- case "vml_shape":
474
- default:
475
- flags.runs = true;
476
- return 1;
477
- }
478
- }
479
- function collectPreservationFeatures(document) {
480
- const entries = [];
481
- const structuredSubPartPaths = collectStructuredSubPartPaths(document);
482
- entries.push(...collectSubPartFeatures(document));
483
- for (const fragment of listOpaqueFragments(document.preservation)) {
484
- const descriptor = describeOpaqueFragment(fragment);
485
- entries.push({
486
- featureEntryId: `feature:${fragment.fragmentId}`,
487
- featureKey: descriptor.featureKey,
488
- featureClass: "preserve-only",
489
- message: descriptor.label,
490
- affectedAnchor: createRangeAnchor(
491
- fragment.lastKnownRange.from,
492
- fragment.lastKnownRange.to
493
- ),
494
- details: {
495
- fragmentId: fragment.fragmentId,
496
- warningId: fragment.warningId,
497
- detail: descriptor.detail
498
- }
499
- });
500
- }
501
- for (const packagePart of listPreservedPackageParts(document.preservation)) {
502
- if (structuredSubPartPaths.has(packagePart.packagePartName)) {
503
- continue;
504
- }
505
- entries.push({
506
- featureEntryId: `feature:package:${packagePart.packagePartName}`,
507
- featureKey: "unknown-package-parts",
508
- featureClass: "preserve-only",
509
- message: `Preserved package part ${packagePart.packagePartName}.`,
510
- details: {
511
- packagePartName: packagePart.packagePartName,
512
- contentType: packagePart.contentType,
513
- relationshipIds: packagePart.relationshipIds
514
- }
515
- });
516
- }
517
- return entries;
518
- }
519
- function collectStructuredSubPartPaths(document) {
520
- const subParts = document.subParts;
521
- if (!subParts) {
522
- return /* @__PURE__ */ new Set();
523
- }
524
- const paths = /* @__PURE__ */ new Set();
525
- for (const header of subParts.headers ?? []) {
526
- paths.add(header.partPath);
527
- }
528
- for (const footer of subParts.footers ?? []) {
529
- paths.add(footer.partPath);
530
- }
531
- if (subParts.footnoteCollection) {
532
- paths.add("/word/footnotes.xml");
533
- paths.add("/word/endnotes.xml");
534
- }
535
- if (subParts.theme) {
536
- paths.add("/word/theme/theme1.xml");
537
- }
538
- return paths;
539
- }
540
- function collectSubPartFeatures(document) {
541
- const subParts = document.subParts;
542
- if (!subParts) {
543
- return [];
544
- }
545
- const entries = collectLossySubPartFeatures(subParts);
546
- const hasHeaderFooterContent = (subParts.headers?.length ?? 0) > 0 || (subParts.footers?.length ?? 0) > 0;
547
- const noteCount = Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length + Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length;
548
- if (hasHeaderFooterContent && !entries.some((entry) => entry.featureKey === "headers-footers-lossy")) {
549
- entries.push({
550
- featureEntryId: "feature:subparts:headers-footers",
551
- featureKey: "headers-footers",
552
- featureClass: "supported-roundtrip",
553
- message: "Headers and footers resolve as structured secondary stories with export-safe ownership.",
554
- details: {
555
- headerCount: subParts.headers?.length ?? 0,
556
- footerCount: subParts.footers?.length ?? 0
557
- }
558
- });
559
- }
560
- if (noteCount > 0 && !entries.some((entry) => entry.featureKey === "notes-lossy")) {
561
- entries.push({
562
- featureEntryId: "feature:subparts:notes",
563
- featureKey: "notes",
564
- featureClass: "supported-roundtrip",
565
- message: "Footnotes and endnotes resolve as structured secondary stories with export-safe ownership.",
566
- details: {
567
- footnoteCount: Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length,
568
- endnoteCount: Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length
569
- }
570
- });
571
- }
572
- if (subParts.theme) {
573
- entries.push({
574
- featureEntryId: "feature:subparts:theme",
575
- featureKey: "unknown-package-parts",
576
- featureClass: "preserve-only",
577
- message: "Theme metadata is preserved through structured sub-part ownership.",
578
- details: {
579
- surface: "theme-subpart",
580
- themeName: subParts.theme.name
581
- }
582
- });
583
- }
584
- return entries;
585
- }
586
- function collectLossySubPartFeatures(subParts) {
587
- const entries = [];
588
- const headerFooterLossy = [
589
- ...(subParts.headers ?? []).flatMap(
590
- (header) => collectLossyBlocks(header.blocks, `header:${header.partPath}`)
591
- ),
592
- ...(subParts.footers ?? []).flatMap(
593
- (footer) => collectLossyBlocks(footer.blocks, `footer:${footer.partPath}`)
594
- )
595
- ];
596
- if (headerFooterLossy.length > 0) {
597
- entries.push({
598
- featureEntryId: "feature:subparts:headers-footers-lossy",
599
- featureKey: "headers-footers-lossy",
600
- featureClass: "unsupported-fatal",
601
- message: "Headers or footers contain content the current sub-part serializer cannot re-emit safely.",
602
- details: {
603
- issues: headerFooterLossy
604
- }
605
- });
606
- }
607
- const noteLossy = [
608
- ...Object.values(subParts.footnoteCollection?.footnotes ?? {}).flatMap(
609
- (note) => collectLossyBlocks(note.blocks, `footnote:${note.noteId}`)
610
- ),
611
- ...Object.values(subParts.footnoteCollection?.endnotes ?? {}).flatMap(
612
- (note) => collectLossyBlocks(note.blocks, `endnote:${note.noteId}`)
613
- )
614
- ];
615
- if (noteLossy.length > 0) {
616
- entries.push({
617
- featureEntryId: "feature:subparts:notes-lossy",
618
- featureKey: "notes-lossy",
619
- featureClass: "unsupported-fatal",
620
- message: "Footnotes or endnotes contain content the current sub-part serializer cannot re-emit safely.",
621
- details: {
622
- issues: noteLossy
623
- }
624
- });
625
- }
626
- return entries;
627
- }
628
- function collectLossyBlocks(blocks, surface) {
629
- const issues = [];
630
- for (const block of blocks) {
631
- if (block.type === "table") {
632
- for (const row of block.rows) {
633
- for (const cell of row.cells) {
634
- issues.push(...collectLossyBlocks(cell.children, `${surface}:table-cell`));
635
- }
636
- }
637
- continue;
638
- }
639
- if (block.type !== "paragraph") {
640
- issues.push(`${surface}:${block.type}`);
641
- continue;
642
- }
643
- if (block.numbering !== void 0 || block.keepNext !== void 0 || block.keepLines !== void 0 || block.outlineLevel !== void 0 || block.pageBreakBefore !== void 0 || block.widowControl !== void 0 || block.borders !== void 0 || block.shading !== void 0 || block.bidi !== void 0 || block.suppressLineNumbers !== void 0 || block.cnfStyle !== void 0) {
644
- issues.push(`${surface}:paragraph-properties`);
645
- }
646
- for (const child of block.children) {
647
- issues.push(...collectLossyInlineContent(child, surface));
648
- }
649
- }
650
- return [...new Set(issues)];
651
- }
652
- function collectLossyInlineContent(node, surface) {
653
- switch (node.type) {
654
- case "text": {
655
- const allowSecondaryStoryColorMarks = surface.startsWith("header:") || surface.startsWith("footer:");
656
- const unsupportedMarks = (node.marks ?? []).filter(
657
- (mark) => mark.type !== "bold" && mark.type !== "italic" && mark.type !== "underline" && mark.type !== "strikethrough" && mark.type !== "doubleStrikethrough" && mark.type !== "fontFamily" && mark.type !== "fontSize" && mark.type !== "textColor" && (!allowSecondaryStoryColorMarks || mark.type !== "backgroundColor") && (!allowSecondaryStoryColorMarks || mark.type !== "highlight") && mark.type !== "smallCaps" && mark.type !== "allCaps"
658
- ).map((mark) => `${surface}:mark:${mark.type}`);
659
- return unsupportedMarks;
660
- }
661
- case "tab":
662
- case "hard_break":
663
- case "footnote_ref":
664
- case "field":
665
- case "bookmark_start":
666
- case "bookmark_end":
667
- case "shape":
668
- case "wordart":
669
- case "vml_shape":
670
- case "chart_preview":
671
- case "smartart_preview":
672
- return [];
673
- default:
674
- return [`${surface}:${node.type}`];
675
- }
676
- }
677
- function collectDiagnosticWarnings(document) {
678
- const diagnostics = Array.isArray(document.diagnostics?.warnings) ? document.diagnostics.warnings : [];
679
- return diagnostics.map((warning) => ({
680
- warningId: warning.warningId,
681
- code: warning.source === "validation" || warning.source === "export" ? "export_roundtrip_risk" : warning.source === "preservation" ? "unsupported_ooxml_preserved" : "import_normalized",
682
- severity: "warning",
683
- message: warning.message,
684
- source: warning.source
685
- }));
686
- }
687
- function collectDiagnosticErrors(document) {
688
- const diagnostics = Array.isArray(document.diagnostics?.errors) ? document.diagnostics.errors : [];
689
- return diagnostics.map((error) => ({
690
- errorId: error.diagnosticId,
691
- code: error.code === "load_failed" ? "import_failed" : error.code,
692
- message: error.message,
693
- isFatal: error.isFatal,
694
- source: error.source
695
- }));
696
- }
697
- function supportedEntry(featureKey, message) {
698
- return {
699
- featureEntryId: `feature:${featureKey}`,
700
- featureKey,
701
- featureClass: "supported-roundtrip",
702
- message
703
- };
704
- }
705
- function dedupeWarnings(warnings) {
706
- const byId = /* @__PURE__ */ new Map();
707
- for (const warning of warnings) {
708
- byId.set(warning.warningId, warning);
709
- }
710
- return [...byId.values()];
711
- }
712
- function dedupeErrors(errors) {
713
- const byId = /* @__PURE__ */ new Map();
714
- for (const error of errors) {
715
- byId.set(error.errorId, error);
716
- }
717
- return [...byId.values()];
718
- }
719
-
720
- // src/validation/diagnostics.ts
721
- var EXPORT_BLOCKING_ERROR_CODES = /* @__PURE__ */ new Set([
722
- "import_failed",
723
- "export_failed",
724
- "package_corrupt",
725
- "validation_failed"
726
- ]);
727
- function createDiagnostics(input = {}) {
728
- return {
729
- featureEntries: freezeArray(input.featureEntries ?? []),
730
- warnings: freezeArray(input.warnings ?? []),
731
- errors: freezeArray(input.errors ?? [])
732
- };
733
- }
734
- function diagnosticsBlockExport(diagnostics, explicitBlockExport = false) {
735
- if (explicitBlockExport) {
736
- return true;
737
- }
738
- return diagnostics.featureEntries.some(
739
- (entry) => entry.featureClass === "unsupported-fatal"
740
- ) || diagnostics.errors.some(
741
- (error) => error.isFatal || EXPORT_BLOCKING_ERROR_CODES.has(error.code)
742
- );
743
- }
744
- function freezeArray(items) {
745
- return Object.freeze([...items]);
746
- }
747
-
748
- export {
749
- EDITOR_SESSION_STATE_VERSION,
750
- createEditorSessionState,
751
- editorSessionStateFromPersistedSnapshot,
752
- persistedSnapshotFromEditorSessionState,
753
- createRevisionRangeAnchor,
754
- getRevisionActionability,
755
- createRevisionRecord,
756
- setRevisionStatus,
757
- remapRevisionStore,
758
- createRevisionSidebarProjection,
759
- buildCompatibilityReport,
760
- createDiagnostics,
761
- diagnosticsBlockExport
762
- };
763
- //# sourceMappingURL=chunk-2FJS5GZM.js.map