@beyondwork/docx-react-component 1.0.29 → 1.0.31

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 (383) 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/responsive-chrome.ts +46 -0
  180. package/src/ui-tailwind/chrome/review-queue-bar.tsx +97 -0
  181. package/src/ui-tailwind/chrome/tw-alert-banner.tsx +64 -0
  182. package/src/ui-tailwind/chrome/tw-context-analytics-summary.tsx +122 -0
  183. package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +121 -0
  184. package/src/ui-tailwind/chrome/tw-layout-panel.tsx +114 -0
  185. package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +30 -0
  186. package/src/ui-tailwind/chrome/tw-page-ruler.tsx +365 -0
  187. package/src/ui-tailwind/chrome/tw-selection-tool-blocked.tsx +23 -0
  188. package/src/ui-tailwind/chrome/tw-selection-tool-comment.tsx +35 -0
  189. package/src/ui-tailwind/chrome/tw-selection-tool-formatting.tsx +37 -0
  190. package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +303 -0
  191. package/src/ui-tailwind/chrome/tw-selection-tool-structure.tsx +116 -0
  192. package/src/ui-tailwind/chrome/tw-selection-tool-suggestion.tsx +29 -0
  193. package/src/ui-tailwind/chrome/tw-selection-tool-workflow.tsx +27 -0
  194. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +186 -0
  195. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +139 -0
  196. package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +250 -0
  197. package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +58 -0
  198. package/src/ui-tailwind/chrome/use-before-unload.ts +20 -0
  199. package/src/ui-tailwind/editor-surface/perf-probe.ts +179 -0
  200. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +189 -0
  201. package/src/ui-tailwind/editor-surface/pm-contextual-ui.ts +31 -0
  202. package/src/ui-tailwind/editor-surface/pm-decorations.ts +411 -0
  203. package/src/ui-tailwind/editor-surface/pm-position-map.ts +123 -0
  204. package/src/ui-tailwind/editor-surface/pm-schema.ts +927 -0
  205. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +567 -0
  206. package/src/ui-tailwind/editor-surface/search-plugin.ts +168 -0
  207. package/src/ui-tailwind/editor-surface/surface-build-keys.ts +63 -0
  208. package/src/ui-tailwind/editor-surface/tw-caret.tsx +12 -0
  209. package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +150 -0
  210. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +129 -0
  211. package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +58 -0
  212. package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +151 -0
  213. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +1047 -0
  214. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +111 -0
  215. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +503 -0
  216. package/src/ui-tailwind/index.ts +62 -0
  217. package/src/ui-tailwind/page-chrome-model.ts +27 -0
  218. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +406 -0
  219. package/src/ui-tailwind/review/tw-health-panel.tsx +149 -0
  220. package/src/ui-tailwind/review/tw-review-rail.tsx +130 -0
  221. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +164 -0
  222. package/src/ui-tailwind/status/tw-status-bar.tsx +65 -0
  223. package/{dist → src}/ui-tailwind/theme/editor-theme.css +58 -40
  224. package/src/ui-tailwind/toolbar/toolbar-layout.ts +47 -0
  225. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +52 -0
  226. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +1478 -0
  227. package/src/ui-tailwind/tw-review-workspace.tsx +1587 -0
  228. package/src/validation/README.md +3 -0
  229. package/src/validation/compatibility-engine.ts +878 -0
  230. package/src/validation/compatibility-report.ts +161 -0
  231. package/src/validation/diagnostics.ts +204 -0
  232. package/src/validation/docx-comment-proof.ts +720 -0
  233. package/src/validation/import-diagnostics.ts +128 -0
  234. package/src/validation/low-priority-word-surfaces.ts +373 -0
  235. package/dist/canonical-document-BLEbzL2J.d.cts +0 -844
  236. package/dist/canonical-document-BLEbzL2J.d.ts +0 -844
  237. package/dist/chunk-2FJS5GZM.js +0 -763
  238. package/dist/chunk-2FJS5GZM.js.map +0 -1
  239. package/dist/chunk-2OQBZS3F.js +0 -446
  240. package/dist/chunk-2OQBZS3F.js.map +0 -1
  241. package/dist/chunk-2S7W4KFO.js +0 -127
  242. package/dist/chunk-2S7W4KFO.js.map +0 -1
  243. package/dist/chunk-2TG72QSW.js +0 -3874
  244. package/dist/chunk-2TG72QSW.js.map +0 -1
  245. package/dist/chunk-36QNIZBO.js +0 -532
  246. package/dist/chunk-36QNIZBO.js.map +0 -1
  247. package/dist/chunk-4AQOYAW4.js +0 -3069
  248. package/dist/chunk-4AQOYAW4.js.map +0 -1
  249. package/dist/chunk-4D5EWJ3P.js +0 -77
  250. package/dist/chunk-4D5EWJ3P.js.map +0 -1
  251. package/dist/chunk-5FN54NDH.js +0 -2257
  252. package/dist/chunk-5FN54NDH.js.map +0 -1
  253. package/dist/chunk-BOYGQYRQ.js +0 -7306
  254. package/dist/chunk-BOYGQYRQ.js.map +0 -1
  255. package/dist/chunk-CN3XMECL.js +0 -212
  256. package/dist/chunk-CN3XMECL.js.map +0 -1
  257. package/dist/chunk-EBI3BX6U.js +0 -164
  258. package/dist/chunk-EBI3BX6U.js.map +0 -1
  259. package/dist/chunk-EILUG3VB.js +0 -1275
  260. package/dist/chunk-EILUG3VB.js.map +0 -1
  261. package/dist/chunk-FUDY333O.js +0 -70
  262. package/dist/chunk-FUDY333O.js.map +0 -1
  263. package/dist/chunk-GBVOWFIK.js +0 -1237
  264. package/dist/chunk-GBVOWFIK.js.map +0 -1
  265. package/dist/chunk-H4TQ3H3Y.js +0 -262
  266. package/dist/chunk-H4TQ3H3Y.js.map +0 -1
  267. package/dist/chunk-JGB3IXZO.js +0 -189
  268. package/dist/chunk-JGB3IXZO.js.map +0 -1
  269. package/dist/chunk-KD2QRQPY.js +0 -4342
  270. package/dist/chunk-KD2QRQPY.js.map +0 -1
  271. package/dist/chunk-KLMXQVYK.js +0 -369
  272. package/dist/chunk-KLMXQVYK.js.map +0 -1
  273. package/dist/chunk-KZUG5KFQ.js +0 -214
  274. package/dist/chunk-KZUG5KFQ.js.map +0 -1
  275. package/dist/chunk-QDAQ4CJU.js +0 -345
  276. package/dist/chunk-QDAQ4CJU.js.map +0 -1
  277. package/dist/chunk-RMH72RZI.js.map +0 -1
  278. package/dist/chunk-SWKWQZXM.js +0 -117
  279. package/dist/chunk-SWKWQZXM.js.map +0 -1
  280. package/dist/chunk-TJBP2K4T.js.map +0 -1
  281. package/dist/chunk-TLCEAQDQ.js +0 -542
  282. package/dist/chunk-TLCEAQDQ.js.map +0 -1
  283. package/dist/chunk-UZXBISGO.js.map +0 -1
  284. package/dist/chunk-WGBAKP3Q.js +0 -3220
  285. package/dist/chunk-WGBAKP3Q.js.map +0 -1
  286. package/dist/compare/index.cjs +0 -5475
  287. package/dist/compare/index.cjs.map +0 -1
  288. package/dist/compare/index.d.cts +0 -114
  289. package/dist/compare/index.d.ts +0 -114
  290. package/dist/compare/index.js +0 -731
  291. package/dist/compare/index.js.map +0 -1
  292. package/dist/core/commands/formatting-commands.cjs +0 -828
  293. package/dist/core/commands/formatting-commands.cjs.map +0 -1
  294. package/dist/core/commands/formatting-commands.d.cts +0 -63
  295. package/dist/core/commands/formatting-commands.d.ts +0 -63
  296. package/dist/core/commands/formatting-commands.js +0 -37
  297. package/dist/core/commands/formatting-commands.js.map +0 -1
  298. package/dist/core/commands/image-commands.cjs +0 -2023
  299. package/dist/core/commands/image-commands.cjs.map +0 -1
  300. package/dist/core/commands/image-commands.d.cts +0 -58
  301. package/dist/core/commands/image-commands.d.ts +0 -58
  302. package/dist/core/commands/image-commands.js +0 -18
  303. package/dist/core/commands/image-commands.js.map +0 -1
  304. package/dist/core/commands/section-layout-commands.cjs.map +0 -1
  305. package/dist/core/commands/section-layout-commands.d.cts +0 -62
  306. package/dist/core/commands/section-layout-commands.d.ts +0 -62
  307. package/dist/core/commands/section-layout-commands.js +0 -21
  308. package/dist/core/commands/section-layout-commands.js.map +0 -1
  309. package/dist/core/commands/style-commands.cjs.map +0 -1
  310. package/dist/core/commands/style-commands.d.cts +0 -13
  311. package/dist/core/commands/style-commands.d.ts +0 -13
  312. package/dist/core/commands/style-commands.js +0 -9
  313. package/dist/core/commands/style-commands.js.map +0 -1
  314. package/dist/core/commands/table-structure-commands.cjs +0 -1883
  315. package/dist/core/commands/table-structure-commands.cjs.map +0 -1
  316. package/dist/core/commands/table-structure-commands.d.cts +0 -59
  317. package/dist/core/commands/table-structure-commands.d.ts +0 -59
  318. package/dist/core/commands/table-structure-commands.js +0 -12
  319. package/dist/core/commands/table-structure-commands.js.map +0 -1
  320. package/dist/core/commands/text-commands.cjs +0 -2391
  321. package/dist/core/commands/text-commands.cjs.map +0 -1
  322. package/dist/core/commands/text-commands.d.cts +0 -24
  323. package/dist/core/commands/text-commands.d.ts +0 -24
  324. package/dist/core/commands/text-commands.js +0 -28
  325. package/dist/core/commands/text-commands.js.map +0 -1
  326. package/dist/core/selection/mapping.cjs +0 -200
  327. package/dist/core/selection/mapping.cjs.map +0 -1
  328. package/dist/core/selection/mapping.d.cts +0 -2
  329. package/dist/core/selection/mapping.d.ts +0 -2
  330. package/dist/core/selection/mapping.js +0 -31
  331. package/dist/core/selection/mapping.js.map +0 -1
  332. package/dist/core/state/editor-state.cjs +0 -2278
  333. package/dist/core/state/editor-state.cjs.map +0 -1
  334. package/dist/core/state/editor-state.d.cts +0 -2
  335. package/dist/core/state/editor-state.d.ts +0 -2
  336. package/dist/core/state/editor-state.js +0 -26
  337. package/dist/core/state/editor-state.js.map +0 -1
  338. package/dist/index.cjs +0 -38553
  339. package/dist/index.cjs.map +0 -1
  340. package/dist/index.d.cts +0 -15
  341. package/dist/index.d.ts +0 -15
  342. package/dist/index.js +0 -7856
  343. package/dist/index.js.map +0 -1
  344. package/dist/io/docx-session.cjs +0 -16236
  345. package/dist/io/docx-session.cjs.map +0 -1
  346. package/dist/io/docx-session.d.cts +0 -21
  347. package/dist/io/docx-session.d.ts +0 -21
  348. package/dist/io/docx-session.js +0 -18
  349. package/dist/io/docx-session.js.map +0 -1
  350. package/dist/legal/index.cjs +0 -3900
  351. package/dist/legal/index.cjs.map +0 -1
  352. package/dist/legal/index.d.cts +0 -86
  353. package/dist/legal/index.d.ts +0 -86
  354. package/dist/legal/index.js +0 -616
  355. package/dist/legal/index.js.map +0 -1
  356. package/dist/public-types-7ZL_94cz.d.ts +0 -1573
  357. package/dist/public-types-CeMaDueh.d.cts +0 -1573
  358. package/dist/public-types.cjs +0 -19
  359. package/dist/public-types.cjs.map +0 -1
  360. package/dist/public-types.d.cts +0 -2
  361. package/dist/public-types.d.ts +0 -2
  362. package/dist/public-types.js +0 -1
  363. package/dist/public-types.js.map +0 -1
  364. package/dist/runtime/document-runtime.cjs +0 -11140
  365. package/dist/runtime/document-runtime.cjs.map +0 -1
  366. package/dist/runtime/document-runtime.d.cts +0 -231
  367. package/dist/runtime/document-runtime.d.ts +0 -231
  368. package/dist/runtime/document-runtime.js +0 -21
  369. package/dist/runtime/document-runtime.js.map +0 -1
  370. package/dist/structural-helpers-CilgOVhh.d.cts +0 -10
  371. package/dist/structural-helpers-q0Gd-eBN.d.ts +0 -10
  372. package/dist/ui-tailwind/editor-surface/search-plugin.cjs +0 -313
  373. package/dist/ui-tailwind/editor-surface/search-plugin.cjs.map +0 -1
  374. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +0 -67
  375. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +0 -67
  376. package/dist/ui-tailwind/editor-surface/search-plugin.js +0 -23
  377. package/dist/ui-tailwind/editor-surface/search-plugin.js.map +0 -1
  378. package/dist/ui-tailwind/index.cjs +0 -4833
  379. package/dist/ui-tailwind/index.cjs.map +0 -1
  380. package/dist/ui-tailwind/index.d.cts +0 -617
  381. package/dist/ui-tailwind/index.d.ts +0 -617
  382. package/dist/ui-tailwind/index.js +0 -575
  383. package/dist/ui-tailwind/index.js.map +0 -1
@@ -1,532 +0,0 @@
1
- import {
2
- createEmptyParagraph,
3
- createNoopStructuralMutation,
4
- findTableCellParagraphSelection,
5
- findTopLevelParagraphSelectionNearBlock
6
- } from "./chunk-KZUG5KFQ.js";
7
- import {
8
- createDetachedAnchor,
9
- createNodeAnchor,
10
- createRangeAnchor
11
- } from "./chunk-EBI3BX6U.js";
12
-
13
- // src/core/commands/table-structure-commands.ts
14
- function applyTableStructureOperation(document, snapshot, selectionDescriptor, operation) {
15
- const root = document.content;
16
- const fallbackSelection = toInternalSelectionSnapshot(snapshot.selection);
17
- if (!root || root.type !== "doc") {
18
- return createNoopStructuralMutation(document, fallbackSelection);
19
- }
20
- const effectiveSelection = selectionDescriptor ?? resolveTableSelectionFromSnapshot(snapshot);
21
- if (!effectiveSelection) {
22
- return createNoopStructuralMutation(document, fallbackSelection);
23
- }
24
- const target = root.children[effectiveSelection.tableBlockIndex];
25
- if (!target || target.type !== "table") {
26
- return createNoopStructuralMutation(document, fallbackSelection);
27
- }
28
- switch (operation.type) {
29
- case "delete-table":
30
- return deleteTableBlock(document, root, effectiveSelection.tableBlockIndex, fallbackSelection);
31
- case "set-cell-background":
32
- return setCellBackground(document, root, target, effectiveSelection, operation.color, fallbackSelection);
33
- case "split-cell":
34
- return splitSelectedCell(document, root, target, effectiveSelection, fallbackSelection);
35
- case "merge-cells":
36
- return mergeSelectedCells(document, root, target, effectiveSelection, fallbackSelection);
37
- case "add-row-before":
38
- return addRow(document, root, target, effectiveSelection, "before", fallbackSelection);
39
- case "add-row-after":
40
- return addRow(document, root, target, effectiveSelection, "after", fallbackSelection);
41
- case "delete-row":
42
- return deleteRow(document, root, target, effectiveSelection, fallbackSelection);
43
- case "add-column-before":
44
- return addColumn(document, root, target, effectiveSelection, "before", fallbackSelection);
45
- case "add-column-after":
46
- return addColumn(document, root, target, effectiveSelection, "after", fallbackSelection);
47
- case "delete-column":
48
- return deleteColumn(document, root, target, effectiveSelection, fallbackSelection);
49
- default:
50
- return createNoopStructuralMutation(document, fallbackSelection);
51
- }
52
- }
53
- function addRow(document, root, table, selection, position, fallbackSelection) {
54
- if (!isSimpleTable(table)) {
55
- return createNoopStructuralMutation(document, fallbackSelection);
56
- }
57
- const columnCount = getLogicalColumnCount(table);
58
- const insertIndex = position === "before" ? selection.anchorCell.rowIndex : selection.anchorCell.rowIndex + 1;
59
- const nextRow = {
60
- type: "table_row",
61
- cells: Array.from({ length: columnCount }, () => createEmptyCell())
62
- };
63
- const nextTable = {
64
- ...table,
65
- rows: [
66
- ...table.rows.slice(0, insertIndex),
67
- nextRow,
68
- ...table.rows.slice(insertIndex)
69
- ]
70
- };
71
- return commitTableChange(
72
- document,
73
- root,
74
- selection.tableBlockIndex,
75
- nextTable,
76
- fallbackSelection,
77
- insertIndex,
78
- selection.anchorCell.columnIndex
79
- );
80
- }
81
- function deleteRow(document, root, table, selection, fallbackSelection) {
82
- if (!isSimpleTable(table) || table.rows.length <= 1) {
83
- return createNoopStructuralMutation(document, fallbackSelection);
84
- }
85
- const deleteIndex = selection.anchorCell.rowIndex;
86
- const nextRows = table.rows.filter((_, rowIndex) => rowIndex !== deleteIndex);
87
- const focusRowIndex = Math.max(0, Math.min(deleteIndex, nextRows.length - 1));
88
- const nextTable = {
89
- ...table,
90
- rows: nextRows
91
- };
92
- return commitTableChange(
93
- document,
94
- root,
95
- selection.tableBlockIndex,
96
- nextTable,
97
- fallbackSelection,
98
- focusRowIndex,
99
- selection.anchorCell.columnIndex
100
- );
101
- }
102
- function addColumn(document, root, table, selection, position, fallbackSelection) {
103
- if (!isSimpleTable(table)) {
104
- return createNoopStructuralMutation(document, fallbackSelection);
105
- }
106
- const insertIndex = position === "before" ? selection.anchorCell.columnIndex : selection.anchorCell.columnIndex + 1;
107
- const nextTable = {
108
- ...table,
109
- gridColumns: insertGridColumn(table.gridColumns, insertIndex),
110
- rows: table.rows.map((row) => ({
111
- ...row,
112
- cells: [
113
- ...row.cells.slice(0, insertIndex),
114
- createEmptyCell(),
115
- ...row.cells.slice(insertIndex)
116
- ]
117
- }))
118
- };
119
- return commitTableChange(
120
- document,
121
- root,
122
- selection.tableBlockIndex,
123
- nextTable,
124
- fallbackSelection,
125
- selection.anchorCell.rowIndex,
126
- insertIndex
127
- );
128
- }
129
- function deleteColumn(document, root, table, selection, fallbackSelection) {
130
- if (!isSimpleTable(table) || getLogicalColumnCount(table) <= 1) {
131
- return createNoopStructuralMutation(document, fallbackSelection);
132
- }
133
- const deleteIndex = selection.anchorCell.columnIndex;
134
- const nextTable = {
135
- ...table,
136
- gridColumns: deleteGridColumn(table.gridColumns, deleteIndex),
137
- rows: table.rows.map((row) => ({
138
- ...row,
139
- cells: row.cells.filter((_, cellIndex) => cellIndex !== deleteIndex)
140
- }))
141
- };
142
- const focusColumnIndex = Math.max(0, Math.min(deleteIndex, getLogicalColumnCount(nextTable) - 1));
143
- return commitTableChange(
144
- document,
145
- root,
146
- selection.tableBlockIndex,
147
- nextTable,
148
- fallbackSelection,
149
- selection.anchorCell.rowIndex,
150
- focusColumnIndex
151
- );
152
- }
153
- function mergeSelectedCells(document, root, table, selection, fallbackSelection) {
154
- if (!isSimpleTable(table) || selection.selectionKind !== "cell" || selection.rect.bottom - selection.rect.top < 1 || selection.rect.right - selection.rect.left < 1) {
155
- return createNoopStructuralMutation(document, fallbackSelection);
156
- }
157
- const height = selection.rect.bottom - selection.rect.top;
158
- const width = selection.rect.right - selection.rect.left;
159
- if (height === 1 && width === 1) {
160
- return createNoopStructuralMutation(document, fallbackSelection);
161
- }
162
- const nextRows = table.rows.map((row) => ({
163
- ...row,
164
- cells: row.cells.map((cell) => cloneCell(cell))
165
- }));
166
- const mergedChildren = [];
167
- for (let rowIndex = selection.rect.top; rowIndex < selection.rect.bottom; rowIndex += 1) {
168
- const row = nextRows[rowIndex];
169
- if (!row) {
170
- return createNoopStructuralMutation(document, fallbackSelection);
171
- }
172
- for (let columnIndex = selection.rect.left; columnIndex < selection.rect.right; columnIndex += 1) {
173
- const cellRef = findCellAtColumn(row, columnIndex);
174
- if (!cellRef) {
175
- return createNoopStructuralMutation(document, fallbackSelection);
176
- }
177
- const paragraphs = cellRef.cell.children.filter(
178
- (child) => child.type === "paragraph"
179
- );
180
- mergedChildren.push(...paragraphs.map((paragraph) => structuredClone(paragraph)));
181
- }
182
- }
183
- const topRow = nextRows[selection.rect.top];
184
- if (!topRow) {
185
- return createNoopStructuralMutation(document, fallbackSelection);
186
- }
187
- const topLeftRef = findCellAtColumn(topRow, selection.rect.left);
188
- if (!topLeftRef) {
189
- return createNoopStructuralMutation(document, fallbackSelection);
190
- }
191
- topRow.cells[topLeftRef.cellIndex] = {
192
- ...topLeftRef.cell,
193
- ...width > 1 ? { gridSpan: width } : {},
194
- ...height > 1 ? { verticalMerge: "restart" } : {},
195
- children: mergedChildren.length > 0 ? mergedChildren : [createEmptyParagraph()]
196
- };
197
- topRow.cells.splice(topLeftRef.cellIndex + 1, width - 1);
198
- for (let rowIndex = selection.rect.top + 1; rowIndex < selection.rect.bottom; rowIndex += 1) {
199
- const row = nextRows[rowIndex];
200
- const leftRef = findCellAtColumn(row, selection.rect.left);
201
- if (!leftRef) {
202
- return createNoopStructuralMutation(document, fallbackSelection);
203
- }
204
- row.cells.splice(
205
- leftRef.cellIndex,
206
- width,
207
- {
208
- ...createEmptyCell(),
209
- ...width > 1 ? { gridSpan: width } : {},
210
- verticalMerge: "continue"
211
- }
212
- );
213
- }
214
- const nextTable = {
215
- ...table,
216
- rows: nextRows
217
- };
218
- return commitTableChange(
219
- document,
220
- root,
221
- selection.tableBlockIndex,
222
- nextTable,
223
- fallbackSelection,
224
- selection.rect.top,
225
- selection.rect.left
226
- );
227
- }
228
- function splitSelectedCell(document, root, table, selection, fallbackSelection) {
229
- const row = table.rows[selection.anchorCell.rowIndex];
230
- if (!row) {
231
- return createNoopStructuralMutation(document, fallbackSelection);
232
- }
233
- const cellRef = findCellAtColumn(row, selection.anchorCell.columnIndex);
234
- if (!cellRef) {
235
- return createNoopStructuralMutation(document, fallbackSelection);
236
- }
237
- const width = Math.max(1, cellRef.cell.gridSpan ?? 1);
238
- const height = Math.max(
239
- 1,
240
- computeRowSpan(table, selection.anchorCell.rowIndex, selection.anchorCell.columnIndex, width)
241
- );
242
- if (width === 1 && height === 1) {
243
- return createNoopStructuralMutation(document, fallbackSelection);
244
- }
245
- const nextRows = table.rows.map((currentRow) => ({
246
- ...currentRow,
247
- cells: currentRow.cells.map((cell) => cloneCell(cell))
248
- }));
249
- const topRow = nextRows[selection.anchorCell.rowIndex];
250
- topRow.cells.splice(
251
- cellRef.cellIndex,
252
- 1,
253
- stripCellSpan(cellRef.cell),
254
- ...Array.from({ length: width - 1 }, () => createEmptyCell())
255
- );
256
- for (let rowOffset = 1; rowOffset < height; rowOffset += 1) {
257
- const rowIndex = selection.anchorCell.rowIndex + rowOffset;
258
- const currentRow = nextRows[rowIndex];
259
- if (!currentRow) {
260
- break;
261
- }
262
- const continueRef = findCellAtColumn(currentRow, selection.anchorCell.columnIndex);
263
- if (!continueRef) {
264
- return createNoopStructuralMutation(document, fallbackSelection);
265
- }
266
- currentRow.cells.splice(
267
- continueRef.cellIndex,
268
- 1,
269
- ...Array.from({ length: width }, () => createEmptyCell())
270
- );
271
- }
272
- const nextTable = {
273
- ...table,
274
- rows: nextRows
275
- };
276
- return commitTableChange(
277
- document,
278
- root,
279
- selection.tableBlockIndex,
280
- nextTable,
281
- fallbackSelection,
282
- selection.anchorCell.rowIndex,
283
- selection.anchorCell.columnIndex
284
- );
285
- }
286
- function setCellBackground(document, root, table, selection, color, fallbackSelection) {
287
- const normalized = normalizeFillColor(color);
288
- if (!normalized) {
289
- return createNoopStructuralMutation(document, fallbackSelection);
290
- }
291
- const targetRect = selection.selectionKind === "text" ? {
292
- top: 0,
293
- left: 0,
294
- bottom: table.rows.length,
295
- right: getLogicalColumnCount(table)
296
- } : selection.rect;
297
- let changed = false;
298
- const nextRows = table.rows.map((row, rowIndex) => {
299
- if (rowIndex < targetRect.top || rowIndex >= targetRect.bottom) {
300
- return row;
301
- }
302
- let cursor = 0;
303
- const cells = row.cells.map((cell) => {
304
- const start = cursor;
305
- const width = cell.gridSpan ?? 1;
306
- const end = start + width;
307
- cursor = end;
308
- if (end <= targetRect.left || start >= targetRect.right) {
309
- return cell;
310
- }
311
- changed = true;
312
- return {
313
- ...cell,
314
- shading: {
315
- ...cell.shading ?? {},
316
- fill: normalized
317
- }
318
- };
319
- });
320
- return {
321
- ...row,
322
- cells
323
- };
324
- });
325
- if (!changed) {
326
- return createNoopStructuralMutation(document, fallbackSelection);
327
- }
328
- const nextTable = {
329
- ...table,
330
- rows: nextRows
331
- };
332
- return commitTableChange(
333
- document,
334
- root,
335
- selection.tableBlockIndex,
336
- nextTable,
337
- fallbackSelection,
338
- selection.anchorCell.rowIndex,
339
- selection.anchorCell.columnIndex
340
- );
341
- }
342
- function deleteTableBlock(document, root, tableBlockIndex, fallbackSelection) {
343
- const nextChildren = root.children.filter((_, index) => index !== tableBlockIndex);
344
- if (nextChildren.length === 0) {
345
- nextChildren.push(createEmptyParagraph());
346
- }
347
- const nextDocument = {
348
- ...document,
349
- content: {
350
- ...root,
351
- children: nextChildren
352
- }
353
- };
354
- const nextSelection = findTopLevelParagraphSelectionNearBlock(nextDocument, tableBlockIndex) ?? fallbackSelection;
355
- return {
356
- changed: true,
357
- document: nextDocument,
358
- selection: nextSelection
359
- };
360
- }
361
- function commitTableChange(document, root, tableBlockIndex, nextTable, fallbackSelection, focusRowIndex, focusColumnIndex) {
362
- const nextDocument = {
363
- ...document,
364
- content: {
365
- ...root,
366
- children: root.children.map(
367
- (child, index) => index === tableBlockIndex ? nextTable : child
368
- )
369
- }
370
- };
371
- const nextSelection = findTableCellParagraphSelection(
372
- nextDocument,
373
- tableBlockIndex,
374
- focusRowIndex,
375
- focusColumnIndex
376
- ) ?? fallbackSelection;
377
- return {
378
- changed: true,
379
- document: nextDocument,
380
- selection: nextSelection
381
- };
382
- }
383
- function resolveTableSelectionFromSnapshot(snapshot) {
384
- const selectionFrom = Math.min(snapshot.selection.anchor, snapshot.selection.head);
385
- const selectionTo = Math.max(snapshot.selection.anchor, snapshot.selection.head);
386
- const surface = snapshot.surface;
387
- if (!surface) {
388
- return null;
389
- }
390
- for (let tableBlockIndex = 0; tableBlockIndex < surface.blocks.length; tableBlockIndex += 1) {
391
- const block = surface.blocks[tableBlockIndex];
392
- if (block.kind !== "table") {
393
- continue;
394
- }
395
- for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {
396
- const row = block.rows[rowIndex];
397
- for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
398
- const cell = row.cells[cellIndex];
399
- const hit = cell.content.find(
400
- (child) => child.kind === "paragraph" && selectionFrom >= child.from && selectionTo <= child.to
401
- );
402
- if (!hit) {
403
- continue;
404
- }
405
- let logicalColumn = 0;
406
- for (let currentIndex = 0; currentIndex < cellIndex; currentIndex += 1) {
407
- logicalColumn += row.cells[currentIndex]?.gridSpan ?? 1;
408
- }
409
- return {
410
- tableBlockIndex,
411
- selectionKind: "text",
412
- anchorCell: {
413
- rowIndex,
414
- columnIndex: logicalColumn
415
- },
416
- headCell: {
417
- rowIndex,
418
- columnIndex: logicalColumn
419
- },
420
- rect: {
421
- top: rowIndex,
422
- left: logicalColumn,
423
- bottom: rowIndex + 1,
424
- right: logicalColumn + (cell.gridSpan ?? 1)
425
- }
426
- };
427
- }
428
- }
429
- }
430
- return null;
431
- }
432
- function toInternalSelectionSnapshot(selection) {
433
- return {
434
- anchor: selection.anchor,
435
- head: selection.head,
436
- isCollapsed: selection.isCollapsed,
437
- activeRange: selection.activeRange.kind === "range" ? createRangeAnchor(
438
- selection.activeRange.from,
439
- selection.activeRange.to,
440
- selection.activeRange.assoc
441
- ) : selection.activeRange.kind === "node" ? createNodeAnchor(selection.activeRange.at, selection.activeRange.assoc) : createDetachedAnchor(
442
- selection.activeRange.lastKnownRange,
443
- selection.activeRange.reason
444
- )
445
- };
446
- }
447
- function isSimpleTable(table) {
448
- const width = getLogicalColumnCount(table);
449
- return table.rows.every((row) => {
450
- let rowWidth = 0;
451
- for (const cell of row.cells) {
452
- if ((cell.gridSpan ?? 1) !== 1 || cell.verticalMerge) {
453
- return false;
454
- }
455
- rowWidth += 1;
456
- }
457
- return rowWidth === width;
458
- });
459
- }
460
- function getLogicalColumnCount(table) {
461
- if (table.gridColumns.length > 0) {
462
- return table.gridColumns.length;
463
- }
464
- return table.rows.reduce((max, row) => {
465
- const width = row.cells.reduce((sum, cell) => sum + (cell.gridSpan ?? 1), 0);
466
- return Math.max(max, width);
467
- }, 0);
468
- }
469
- function computeRowSpan(table, rowIndex, columnIndex, width) {
470
- let rowspan = 1;
471
- for (let currentRowIndex = rowIndex + 1; currentRowIndex < table.rows.length; currentRowIndex += 1) {
472
- const cellRef = findCellAtColumn(table.rows[currentRowIndex], columnIndex);
473
- if (!cellRef || cellRef.cell.verticalMerge !== "continue" || (cellRef.cell.gridSpan ?? 1) !== width) {
474
- break;
475
- }
476
- rowspan += 1;
477
- }
478
- return rowspan;
479
- }
480
- function findCellAtColumn(row, logicalColumnIndex) {
481
- let cursor = 0;
482
- for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {
483
- const cell = row.cells[cellIndex];
484
- const width = cell.gridSpan ?? 1;
485
- if (logicalColumnIndex >= cursor && logicalColumnIndex < cursor + width) {
486
- return {
487
- cellIndex,
488
- cell
489
- };
490
- }
491
- cursor += width;
492
- }
493
- return null;
494
- }
495
- function createEmptyCell() {
496
- return {
497
- type: "table_cell",
498
- children: [createEmptyParagraph()]
499
- };
500
- }
501
- function cloneCell(cell) {
502
- return structuredClone(cell);
503
- }
504
- function stripCellSpan(cell) {
505
- return {
506
- ...cell,
507
- gridSpan: void 0,
508
- verticalMerge: void 0
509
- };
510
- }
511
- function insertGridColumn(columns, index) {
512
- if (columns.length === 0) {
513
- return columns;
514
- }
515
- const current = columns[index] ?? columns[index - 1] ?? columns[columns.length - 1] ?? 2400;
516
- return [...columns.slice(0, index), current, ...columns.slice(index)];
517
- }
518
- function deleteGridColumn(columns, index) {
519
- if (columns.length <= 1) {
520
- return columns;
521
- }
522
- return columns.filter((_, columnIndex) => columnIndex !== index);
523
- }
524
- function normalizeFillColor(color) {
525
- const normalized = color.trim().replace(/^#/, "");
526
- return /^[0-9A-Fa-f]{3,8}$/.test(normalized) ? normalized.toUpperCase() : null;
527
- }
528
-
529
- export {
530
- applyTableStructureOperation
531
- };
532
- //# sourceMappingURL=chunk-36QNIZBO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/commands/table-structure-commands.ts"],"sourcesContent":["import type { RuntimeRenderSnapshot as PublicRuntimeRenderSnapshot } from \"../../api/public-types\";\nimport type {\n DocumentRootNode,\n ParagraphNode,\n TableCellNode,\n TableNode,\n TableRowNode,\n} from \"../../model/canonical-document.ts\";\nimport type { TableSelectionDescriptor } from \"../../runtime/table-commands.ts\";\nimport type { CanonicalDocumentEnvelope, SelectionSnapshot } from \"../state/editor-state.ts\";\nimport {\n createDetachedAnchor,\n createNodeAnchor,\n createRangeAnchor,\n} from \"../selection/mapping.ts\";\nimport {\n createEmptyParagraph,\n createNoopStructuralMutation,\n findTableCellParagraphSelection,\n findTopLevelParagraphSelectionNearBlock,\n type StructuralMutationResult,\n} from \"./structural-helpers.ts\";\n\ntype TableStructureOperation =\n | { type: \"add-row-before\" }\n | { type: \"add-row-after\" }\n | { type: \"add-column-before\" }\n | { type: \"add-column-after\" }\n | { type: \"delete-row\" }\n | { type: \"delete-column\" }\n | { type: \"delete-table\" }\n | { type: \"merge-cells\" }\n | { type: \"split-cell\" }\n | { type: \"set-cell-background\"; color: string };\n\nexport function applyTableStructureOperation(\n document: CanonicalDocumentEnvelope,\n snapshot: PublicRuntimeRenderSnapshot,\n selectionDescriptor: TableSelectionDescriptor | null,\n operation: TableStructureOperation,\n): StructuralMutationResult {\n const root = document.content;\n const fallbackSelection = toInternalSelectionSnapshot(snapshot.selection);\n if (!root || root.type !== \"doc\") {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const effectiveSelection =\n selectionDescriptor ?? resolveTableSelectionFromSnapshot(snapshot);\n if (!effectiveSelection) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const target = root.children[effectiveSelection.tableBlockIndex];\n if (!target || target.type !== \"table\") {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n switch (operation.type) {\n case \"delete-table\":\n return deleteTableBlock(document, root, effectiveSelection.tableBlockIndex, fallbackSelection);\n case \"set-cell-background\":\n return setCellBackground(document, root, target, effectiveSelection, operation.color, fallbackSelection);\n case \"split-cell\":\n return splitSelectedCell(document, root, target, effectiveSelection, fallbackSelection);\n case \"merge-cells\":\n return mergeSelectedCells(document, root, target, effectiveSelection, fallbackSelection);\n case \"add-row-before\":\n return addRow(document, root, target, effectiveSelection, \"before\", fallbackSelection);\n case \"add-row-after\":\n return addRow(document, root, target, effectiveSelection, \"after\", fallbackSelection);\n case \"delete-row\":\n return deleteRow(document, root, target, effectiveSelection, fallbackSelection);\n case \"add-column-before\":\n return addColumn(document, root, target, effectiveSelection, \"before\", fallbackSelection);\n case \"add-column-after\":\n return addColumn(document, root, target, effectiveSelection, \"after\", fallbackSelection);\n case \"delete-column\":\n return deleteColumn(document, root, target, effectiveSelection, fallbackSelection);\n default:\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n}\n\nfunction addRow(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n position: \"before\" | \"after\",\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n if (!isSimpleTable(table)) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const columnCount = getLogicalColumnCount(table);\n const insertIndex =\n position === \"before\" ? selection.anchorCell.rowIndex : selection.anchorCell.rowIndex + 1;\n const nextRow: TableRowNode = {\n type: \"table_row\",\n cells: Array.from({ length: columnCount }, () => createEmptyCell()),\n };\n const nextTable: TableNode = {\n ...table,\n rows: [\n ...table.rows.slice(0, insertIndex),\n nextRow,\n ...table.rows.slice(insertIndex),\n ],\n };\n\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n insertIndex,\n selection.anchorCell.columnIndex,\n );\n}\n\nfunction deleteRow(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n if (!isSimpleTable(table) || table.rows.length <= 1) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const deleteIndex = selection.anchorCell.rowIndex;\n const nextRows = table.rows.filter((_, rowIndex) => rowIndex !== deleteIndex);\n const focusRowIndex = Math.max(0, Math.min(deleteIndex, nextRows.length - 1));\n const nextTable: TableNode = {\n ...table,\n rows: nextRows,\n };\n\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n focusRowIndex,\n selection.anchorCell.columnIndex,\n );\n}\n\nfunction addColumn(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n position: \"before\" | \"after\",\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n if (!isSimpleTable(table)) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const insertIndex =\n position === \"before\"\n ? selection.anchorCell.columnIndex\n : selection.anchorCell.columnIndex + 1;\n const nextTable: TableNode = {\n ...table,\n gridColumns: insertGridColumn(table.gridColumns, insertIndex),\n rows: table.rows.map((row) => ({\n ...row,\n cells: [\n ...row.cells.slice(0, insertIndex),\n createEmptyCell(),\n ...row.cells.slice(insertIndex),\n ],\n })),\n };\n\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n selection.anchorCell.rowIndex,\n insertIndex,\n );\n}\n\nfunction deleteColumn(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n if (!isSimpleTable(table) || getLogicalColumnCount(table) <= 1) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const deleteIndex = selection.anchorCell.columnIndex;\n const nextTable: TableNode = {\n ...table,\n gridColumns: deleteGridColumn(table.gridColumns, deleteIndex),\n rows: table.rows.map((row) => ({\n ...row,\n cells: row.cells.filter((_, cellIndex) => cellIndex !== deleteIndex),\n })),\n };\n const focusColumnIndex = Math.max(0, Math.min(deleteIndex, getLogicalColumnCount(nextTable) - 1));\n\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n selection.anchorCell.rowIndex,\n focusColumnIndex,\n );\n}\n\nfunction mergeSelectedCells(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n if (\n !isSimpleTable(table) ||\n selection.selectionKind !== \"cell\" ||\n selection.rect.bottom - selection.rect.top < 1 ||\n selection.rect.right - selection.rect.left < 1\n ) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const height = selection.rect.bottom - selection.rect.top;\n const width = selection.rect.right - selection.rect.left;\n if (height === 1 && width === 1) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const nextRows = table.rows.map((row) => ({\n ...row,\n cells: row.cells.map((cell) => cloneCell(cell)),\n }));\n const mergedChildren: ParagraphNode[] = [];\n\n for (let rowIndex = selection.rect.top; rowIndex < selection.rect.bottom; rowIndex += 1) {\n const row = nextRows[rowIndex];\n if (!row) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n for (let columnIndex = selection.rect.left; columnIndex < selection.rect.right; columnIndex += 1) {\n const cellRef = findCellAtColumn(row, columnIndex);\n if (!cellRef) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const paragraphs = cellRef.cell.children.filter(\n (child): child is ParagraphNode => child.type === \"paragraph\",\n );\n mergedChildren.push(...paragraphs.map((paragraph) => structuredClone(paragraph) as ParagraphNode));\n }\n }\n\n const topRow = nextRows[selection.rect.top];\n if (!topRow) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n const topLeftRef = findCellAtColumn(topRow, selection.rect.left);\n if (!topLeftRef) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n topRow.cells[topLeftRef.cellIndex] = {\n ...topLeftRef.cell,\n ...(width > 1 ? { gridSpan: width } : {}),\n ...(height > 1 ? { verticalMerge: \"restart\" as const } : {}),\n children: mergedChildren.length > 0 ? mergedChildren : [createEmptyParagraph()],\n };\n topRow.cells.splice(topLeftRef.cellIndex + 1, width - 1);\n\n for (let rowIndex = selection.rect.top + 1; rowIndex < selection.rect.bottom; rowIndex += 1) {\n const row = nextRows[rowIndex];\n const leftRef = findCellAtColumn(row, selection.rect.left);\n if (!leftRef) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n row.cells.splice(\n leftRef.cellIndex,\n width,\n {\n ...createEmptyCell(),\n ...(width > 1 ? { gridSpan: width } : {}),\n verticalMerge: \"continue\",\n },\n );\n }\n\n const nextTable: TableNode = {\n ...table,\n rows: nextRows,\n };\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n selection.rect.top,\n selection.rect.left,\n );\n}\n\nfunction splitSelectedCell(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n const row = table.rows[selection.anchorCell.rowIndex];\n if (!row) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n const cellRef = findCellAtColumn(row, selection.anchorCell.columnIndex);\n if (!cellRef) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const width = Math.max(1, cellRef.cell.gridSpan ?? 1);\n const height = Math.max(\n 1,\n computeRowSpan(table, selection.anchorCell.rowIndex, selection.anchorCell.columnIndex, width),\n );\n if (width === 1 && height === 1) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const nextRows = table.rows.map((currentRow) => ({\n ...currentRow,\n cells: currentRow.cells.map((cell) => cloneCell(cell)),\n }));\n const topRow = nextRows[selection.anchorCell.rowIndex];\n topRow.cells.splice(\n cellRef.cellIndex,\n 1,\n stripCellSpan(cellRef.cell),\n ...Array.from({ length: width - 1 }, () => createEmptyCell()),\n );\n\n for (let rowOffset = 1; rowOffset < height; rowOffset += 1) {\n const rowIndex = selection.anchorCell.rowIndex + rowOffset;\n const currentRow = nextRows[rowIndex];\n if (!currentRow) {\n break;\n }\n\n const continueRef = findCellAtColumn(currentRow, selection.anchorCell.columnIndex);\n if (!continueRef) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n currentRow.cells.splice(\n continueRef.cellIndex,\n 1,\n ...Array.from({ length: width }, () => createEmptyCell()),\n );\n }\n\n const nextTable: TableNode = {\n ...table,\n rows: nextRows,\n };\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n selection.anchorCell.rowIndex,\n selection.anchorCell.columnIndex,\n );\n}\n\nfunction setCellBackground(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n table: TableNode,\n selection: TableSelectionDescriptor,\n color: string,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n const normalized = normalizeFillColor(color);\n if (!normalized) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const targetRect =\n selection.selectionKind === \"text\"\n ? {\n top: 0,\n left: 0,\n bottom: table.rows.length,\n right: getLogicalColumnCount(table),\n }\n : selection.rect;\n let changed = false;\n const nextRows = table.rows.map((row, rowIndex) => {\n if (rowIndex < targetRect.top || rowIndex >= targetRect.bottom) {\n return row;\n }\n\n let cursor = 0;\n const cells = row.cells.map((cell) => {\n const start = cursor;\n const width = cell.gridSpan ?? 1;\n const end = start + width;\n cursor = end;\n\n if (end <= targetRect.left || start >= targetRect.right) {\n return cell;\n }\n\n changed = true;\n return {\n ...cell,\n shading: {\n ...(cell.shading ?? {}),\n fill: normalized,\n },\n };\n });\n\n return {\n ...row,\n cells,\n };\n });\n\n if (!changed) {\n return createNoopStructuralMutation(document, fallbackSelection);\n }\n\n const nextTable: TableNode = {\n ...table,\n rows: nextRows,\n };\n return commitTableChange(\n document,\n root,\n selection.tableBlockIndex,\n nextTable,\n fallbackSelection,\n selection.anchorCell.rowIndex,\n selection.anchorCell.columnIndex,\n );\n}\n\nfunction deleteTableBlock(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n tableBlockIndex: number,\n fallbackSelection: SelectionSnapshot,\n): StructuralMutationResult {\n const nextChildren = root.children.filter((_, index) => index !== tableBlockIndex);\n if (nextChildren.length === 0) {\n nextChildren.push(createEmptyParagraph());\n }\n\n const nextDocument: CanonicalDocumentEnvelope = {\n ...document,\n content: {\n ...root,\n children: nextChildren,\n },\n };\n const nextSelection =\n findTopLevelParagraphSelectionNearBlock(nextDocument, tableBlockIndex) ??\n fallbackSelection;\n\n return {\n changed: true,\n document: nextDocument,\n selection: nextSelection,\n };\n}\n\nfunction commitTableChange(\n document: CanonicalDocumentEnvelope,\n root: DocumentRootNode,\n tableBlockIndex: number,\n nextTable: TableNode,\n fallbackSelection: SelectionSnapshot,\n focusRowIndex: number,\n focusColumnIndex: number,\n): StructuralMutationResult {\n const nextDocument: CanonicalDocumentEnvelope = {\n ...document,\n content: {\n ...root,\n children: root.children.map((child, index) =>\n index === tableBlockIndex ? nextTable : child,\n ),\n },\n };\n const nextSelection =\n findTableCellParagraphSelection(\n nextDocument,\n tableBlockIndex,\n focusRowIndex,\n focusColumnIndex,\n ) ?? fallbackSelection;\n\n return {\n changed: true,\n document: nextDocument,\n selection: nextSelection,\n };\n}\n\nfunction resolveTableSelectionFromSnapshot(\n snapshot: Pick<PublicRuntimeRenderSnapshot, \"selection\" | \"surface\">,\n): TableSelectionDescriptor | null {\n const selectionFrom = Math.min(snapshot.selection.anchor, snapshot.selection.head);\n const selectionTo = Math.max(snapshot.selection.anchor, snapshot.selection.head);\n const surface = snapshot.surface;\n if (!surface) {\n return null;\n }\n\n for (let tableBlockIndex = 0; tableBlockIndex < surface.blocks.length; tableBlockIndex += 1) {\n const block = surface.blocks[tableBlockIndex];\n if (block.kind !== \"table\") {\n continue;\n }\n\n for (let rowIndex = 0; rowIndex < block.rows.length; rowIndex += 1) {\n const row = block.rows[rowIndex];\n for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {\n const cell = row.cells[cellIndex];\n const hit = cell.content.find(\n (child) =>\n child.kind === \"paragraph\" &&\n selectionFrom >= child.from &&\n selectionTo <= child.to,\n );\n if (!hit) {\n continue;\n }\n\n let logicalColumn = 0;\n for (let currentIndex = 0; currentIndex < cellIndex; currentIndex += 1) {\n logicalColumn += row.cells[currentIndex]?.gridSpan ?? 1;\n }\n\n return {\n tableBlockIndex,\n selectionKind: \"text\",\n anchorCell: {\n rowIndex,\n columnIndex: logicalColumn,\n },\n headCell: {\n rowIndex,\n columnIndex: logicalColumn,\n },\n rect: {\n top: rowIndex,\n left: logicalColumn,\n bottom: rowIndex + 1,\n right: logicalColumn + (cell.gridSpan ?? 1),\n },\n };\n }\n }\n }\n\n return null;\n}\n\nfunction toInternalSelectionSnapshot(\n selection: PublicRuntimeRenderSnapshot[\"selection\"],\n): SelectionSnapshot {\n return {\n anchor: selection.anchor,\n head: selection.head,\n isCollapsed: selection.isCollapsed,\n activeRange:\n selection.activeRange.kind === \"range\"\n ? createRangeAnchor(\n selection.activeRange.from,\n selection.activeRange.to,\n selection.activeRange.assoc,\n )\n : selection.activeRange.kind === \"node\"\n ? createNodeAnchor(selection.activeRange.at, selection.activeRange.assoc)\n : createDetachedAnchor(\n selection.activeRange.lastKnownRange,\n selection.activeRange.reason,\n ),\n };\n}\n\nfunction isSimpleTable(table: TableNode): boolean {\n const width = getLogicalColumnCount(table);\n return table.rows.every((row) => {\n let rowWidth = 0;\n for (const cell of row.cells) {\n if ((cell.gridSpan ?? 1) !== 1 || cell.verticalMerge) {\n return false;\n }\n rowWidth += 1;\n }\n return rowWidth === width;\n });\n}\n\nfunction getLogicalColumnCount(table: TableNode): number {\n if (table.gridColumns.length > 0) {\n return table.gridColumns.length;\n }\n\n return table.rows.reduce((max, row) => {\n const width = row.cells.reduce((sum, cell) => sum + (cell.gridSpan ?? 1), 0);\n return Math.max(max, width);\n }, 0);\n}\n\nfunction computeRowSpan(\n table: TableNode,\n rowIndex: number,\n columnIndex: number,\n width: number,\n): number {\n let rowspan = 1;\n\n for (let currentRowIndex = rowIndex + 1; currentRowIndex < table.rows.length; currentRowIndex += 1) {\n const cellRef = findCellAtColumn(table.rows[currentRowIndex], columnIndex);\n if (\n !cellRef ||\n cellRef.cell.verticalMerge !== \"continue\" ||\n (cellRef.cell.gridSpan ?? 1) !== width\n ) {\n break;\n }\n rowspan += 1;\n }\n\n return rowspan;\n}\n\nfunction findCellAtColumn(\n row: TableRowNode,\n logicalColumnIndex: number,\n): { cellIndex: number; cell: TableCellNode } | null {\n let cursor = 0;\n\n for (let cellIndex = 0; cellIndex < row.cells.length; cellIndex += 1) {\n const cell = row.cells[cellIndex];\n const width = cell.gridSpan ?? 1;\n if (logicalColumnIndex >= cursor && logicalColumnIndex < cursor + width) {\n return {\n cellIndex,\n cell,\n };\n }\n cursor += width;\n }\n\n return null;\n}\n\nfunction createEmptyCell(): TableCellNode {\n return {\n type: \"table_cell\",\n children: [createEmptyParagraph()],\n };\n}\n\nfunction cloneCell(cell: TableCellNode): TableCellNode {\n return structuredClone(cell) as TableCellNode;\n}\n\nfunction stripCellSpan(cell: TableCellNode): TableCellNode {\n return {\n ...cell,\n gridSpan: undefined,\n verticalMerge: undefined,\n };\n}\n\nfunction insertGridColumn(columns: number[], index: number): number[] {\n if (columns.length === 0) {\n return columns;\n }\n\n const current = columns[index] ?? columns[index - 1] ?? columns[columns.length - 1] ?? 2400;\n return [...columns.slice(0, index), current, ...columns.slice(index)];\n}\n\nfunction deleteGridColumn(columns: number[], index: number): number[] {\n if (columns.length <= 1) {\n return columns;\n }\n return columns.filter((_, columnIndex) => columnIndex !== index);\n}\n\nfunction normalizeFillColor(color: string): string | null {\n const normalized = color.trim().replace(/^#/, \"\");\n return /^[0-9A-Fa-f]{3,8}$/.test(normalized) ? normalized.toUpperCase() : null;\n}\n"],"mappings":";;;;;;;;;;;;;AAmCO,SAAS,6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