@portone/docx-editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CONTRIBUTING.md +63 -0
  3. package/LICENSE +203 -0
  4. package/README.md +48 -0
  5. package/assets/editor.png +0 -0
  6. package/dist/DocxEditor.d.ts +123 -0
  7. package/dist/DocxEditor.js +348 -0
  8. package/dist/core.d.ts +36 -0
  9. package/dist/core.js +38 -0
  10. package/dist/docx/comments/constants.d.ts +8 -0
  11. package/dist/docx/comments/constants.js +20 -0
  12. package/dist/docx/comments/model.d.ts +37 -0
  13. package/dist/docx/comments/model.js +104 -0
  14. package/dist/docx/comments/reading.d.ts +36 -0
  15. package/dist/docx/comments/reading.js +149 -0
  16. package/dist/docx/comments/writing.d.ts +11 -0
  17. package/dist/docx/comments/writing.js +327 -0
  18. package/dist/docx/comments.d.ts +3 -0
  19. package/dist/docx/comments.js +4 -0
  20. package/dist/docx/container.d.ts +12 -0
  21. package/dist/docx/container.js +130 -0
  22. package/dist/docx/documentSettings.d.ts +4 -0
  23. package/dist/docx/documentSettings.js +14 -0
  24. package/dist/docx/exportDocx.d.ts +15 -0
  25. package/dist/docx/exportDocx.js +163 -0
  26. package/dist/docx/exportRefs.d.ts +16 -0
  27. package/dist/docx/exportRefs.js +10 -0
  28. package/dist/docx/formatting/direct.d.ts +30 -0
  29. package/dist/docx/formatting/direct.js +201 -0
  30. package/dist/docx/formatting/effectiveParagraph.d.ts +15 -0
  31. package/dist/docx/formatting/effectiveParagraph.js +81 -0
  32. package/dist/docx/formatting/styles.d.ts +67 -0
  33. package/dist/docx/formatting/styles.js +165 -0
  34. package/dist/docx/formatting/tabStops.d.ts +8 -0
  35. package/dist/docx/formatting/tabStops.js +65 -0
  36. package/dist/docx/formatting.d.ts +4 -0
  37. package/dist/docx/formatting.js +4 -0
  38. package/dist/docx/headersFooters.d.ts +36 -0
  39. package/dist/docx/headersFooters.js +218 -0
  40. package/dist/docx/hyperlink.d.ts +75 -0
  41. package/dist/docx/hyperlink.js +71 -0
  42. package/dist/docx/importDocx.d.ts +21 -0
  43. package/dist/docx/importDocx.js +263 -0
  44. package/dist/docx/importParagraph.d.ts +32 -0
  45. package/dist/docx/importParagraph.js +308 -0
  46. package/dist/docx/importTable.d.ts +9 -0
  47. package/dist/docx/importTable.js +275 -0
  48. package/dist/docx/media.d.ts +60 -0
  49. package/dist/docx/media.js +213 -0
  50. package/dist/docx/notes.d.ts +22 -0
  51. package/dist/docx/notes.js +71 -0
  52. package/dist/docx/pageGeometry.d.ts +75 -0
  53. package/dist/docx/pageGeometry.js +88 -0
  54. package/dist/docx/paraProps.d.ts +74 -0
  55. package/dist/docx/paraProps.js +167 -0
  56. package/dist/docx/propsXml.d.ts +49 -0
  57. package/dist/docx/propsXml.js +302 -0
  58. package/dist/docx/relationships.d.ts +42 -0
  59. package/dist/docx/relationships.js +94 -0
  60. package/dist/docx/runProps.d.ts +51 -0
  61. package/dist/docx/runProps.js +207 -0
  62. package/dist/docx/scan.d.ts +20 -0
  63. package/dist/docx/scan.js +110 -0
  64. package/dist/docx/sdt.d.ts +56 -0
  65. package/dist/docx/sdt.js +104 -0
  66. package/dist/docx/sdtProps.d.ts +18 -0
  67. package/dist/docx/sdtProps.js +11 -0
  68. package/dist/docx/serializeBlock.d.ts +4 -0
  69. package/dist/docx/serializeBlock.js +30 -0
  70. package/dist/docx/serializeParagraph.d.ts +15 -0
  71. package/dist/docx/serializeParagraph.js +208 -0
  72. package/dist/docx/serializeTable.d.ts +12 -0
  73. package/dist/docx/serializeTable.js +134 -0
  74. package/dist/docx/session.d.ts +81 -0
  75. package/dist/docx/session.js +79 -0
  76. package/dist/docx/tableFormatting/editing.d.ts +64 -0
  77. package/dist/docx/tableFormatting/editing.js +318 -0
  78. package/dist/docx/tableFormatting/reading.d.ts +96 -0
  79. package/dist/docx/tableFormatting/reading.js +221 -0
  80. package/dist/docx/tableFormatting.d.ts +2 -0
  81. package/dist/docx/tableFormatting.js +3 -0
  82. package/dist/docx/tableTemplate.d.ts +22 -0
  83. package/dist/docx/tableTemplate.js +111 -0
  84. package/dist/docx/theme.d.ts +40 -0
  85. package/dist/docx/theme.js +61 -0
  86. package/dist/docx/uniqueControls.d.ts +14 -0
  87. package/dist/docx/uniqueControls.js +62 -0
  88. package/dist/download.d.ts +57 -0
  89. package/dist/download.js +44 -0
  90. package/dist/editor/clipboard/images.d.ts +14 -0
  91. package/dist/editor/clipboard/images.js +158 -0
  92. package/dist/editor/clipboard/inlineFormatting.d.ts +21 -0
  93. package/dist/editor/clipboard/inlineFormatting.js +232 -0
  94. package/dist/editor/commands/breakCommands.d.ts +8 -0
  95. package/dist/editor/commands/breakCommands.js +19 -0
  96. package/dist/editor/commands/canRunCommand.d.ts +6 -0
  97. package/dist/editor/commands/canRunCommand.js +10 -0
  98. package/dist/editor/commands/commentCommands.d.ts +3 -0
  99. package/dist/editor/commands/commentCommands.js +4 -0
  100. package/dist/editor/commands/comments/editing.d.ts +21 -0
  101. package/dist/editor/commands/comments/editing.js +305 -0
  102. package/dist/editor/commands/comments/model.d.ts +31 -0
  103. package/dist/editor/commands/comments/model.js +0 -0
  104. package/dist/editor/commands/comments/reading.d.ts +8 -0
  105. package/dist/editor/commands/comments/reading.js +58 -0
  106. package/dist/editor/commands/formatting/editing.d.ts +32 -0
  107. package/dist/editor/commands/formatting/editing.js +138 -0
  108. package/dist/editor/commands/formatting/reading.d.ts +57 -0
  109. package/dist/editor/commands/formatting/reading.js +82 -0
  110. package/dist/editor/commands/formatting/shared.d.ts +32 -0
  111. package/dist/editor/commands/formatting/shared.js +53 -0
  112. package/dist/editor/commands/formattingCommands.d.ts +2 -0
  113. package/dist/editor/commands/formattingCommands.js +3 -0
  114. package/dist/editor/commands/historyCommands.d.ts +11 -0
  115. package/dist/editor/commands/historyCommands.js +16 -0
  116. package/dist/editor/commands/indentCommands.d.ts +15 -0
  117. package/dist/editor/commands/indentCommands.js +44 -0
  118. package/dist/editor/commands/index.d.ts +82 -0
  119. package/dist/editor/commands/index.js +171 -0
  120. package/dist/editor/commands/linkCommands.d.ts +56 -0
  121. package/dist/editor/commands/linkCommands.js +146 -0
  122. package/dist/editor/commands/listCommands.d.ts +58 -0
  123. package/dist/editor/commands/listCommands.js +140 -0
  124. package/dist/editor/commands/lockCommands.d.ts +47 -0
  125. package/dist/editor/commands/lockCommands.js +198 -0
  126. package/dist/editor/commands/noteQueries.d.ts +12 -0
  127. package/dist/editor/commands/noteQueries.js +29 -0
  128. package/dist/editor/commands/paragraphCommands.d.ts +59 -0
  129. package/dist/editor/commands/paragraphCommands.js +113 -0
  130. package/dist/editor/commands/spacingCommands.d.ts +23 -0
  131. package/dist/editor/commands/spacingCommands.js +48 -0
  132. package/dist/editor/commands/tabCommands.d.ts +5 -0
  133. package/dist/editor/commands/tabCommands.js +65 -0
  134. package/dist/editor/createEditor.d.ts +59 -0
  135. package/dist/editor/createEditor.js +160 -0
  136. package/dist/editor/documentStyles.d.ts +60 -0
  137. package/dist/editor/documentStyles.js +80 -0
  138. package/dist/editor/externalClipboard.d.ts +11 -0
  139. package/dist/editor/externalClipboard.js +323 -0
  140. package/dist/editor/imageFiles.d.ts +74 -0
  141. package/dist/editor/imageFiles.js +173 -0
  142. package/dist/editor/insertImage.d.ts +31 -0
  143. package/dist/editor/insertImage.js +35 -0
  144. package/dist/editor/insertTable.d.ts +18 -0
  145. package/dist/editor/insertTable.js +44 -0
  146. package/dist/editor/paragraphEdits.d.ts +42 -0
  147. package/dist/editor/paragraphEdits.js +59 -0
  148. package/dist/editor/plainText.d.ts +3 -0
  149. package/dist/editor/plainText.js +50 -0
  150. package/dist/editor/plugins/bookmarkProtection.d.ts +3 -0
  151. package/dist/editor/plugins/bookmarkProtection.js +28 -0
  152. package/dist/editor/plugins/columnResize.d.ts +27 -0
  153. package/dist/editor/plugins/columnResize.js +192 -0
  154. package/dist/editor/plugins/commentDecorations.d.ts +3 -0
  155. package/dist/editor/plugins/commentDecorations.js +23 -0
  156. package/dist/editor/plugins/commentReservations.d.ts +5 -0
  157. package/dist/editor/plugins/commentReservations.js +26 -0
  158. package/dist/editor/plugins/dropCaret.d.ts +10 -0
  159. package/dist/editor/plugins/dropCaret.js +11 -0
  160. package/dist/editor/plugins/imagePaste.d.ts +8 -0
  161. package/dist/editor/plugins/imagePaste.js +265 -0
  162. package/dist/editor/plugins/keymap.d.ts +5 -0
  163. package/dist/editor/plugins/keymap.js +94 -0
  164. package/dist/editor/plugins/linkPanel.d.ts +23 -0
  165. package/dist/editor/plugins/linkPanel.js +39 -0
  166. package/dist/editor/plugins/listInputRules.d.ts +14 -0
  167. package/dist/editor/plugins/listInputRules.js +36 -0
  168. package/dist/editor/plugins/lockedContent.d.ts +6 -0
  169. package/dist/editor/plugins/lockedContent.js +41 -0
  170. package/dist/editor/plugins/noteProtection.d.ts +3 -0
  171. package/dist/editor/plugins/noteProtection.js +25 -0
  172. package/dist/editor/plugins/numberingDecorations.d.ts +42 -0
  173. package/dist/editor/plugins/numberingDecorations.js +110 -0
  174. package/dist/editor/plugins/rowResize.d.ts +15 -0
  175. package/dist/editor/plugins/rowResize.js +196 -0
  176. package/dist/editor/plugins/styledParagraphs.d.ts +15 -0
  177. package/dist/editor/plugins/styledParagraphs.js +65 -0
  178. package/dist/editor/plugins/tabCaret.d.ts +3 -0
  179. package/dist/editor/plugins/tabCaret.js +126 -0
  180. package/dist/editor/plugins/tabDecorations.d.ts +11 -0
  181. package/dist/editor/plugins/tabDecorations.js +87 -0
  182. package/dist/editor/plugins/tabLayout.d.ts +16 -0
  183. package/dist/editor/plugins/tabLayout.js +328 -0
  184. package/dist/editor/plugins/tabPointer.d.ts +7 -0
  185. package/dist/editor/plugins/tabPointer.js +95 -0
  186. package/dist/editor/plugins/tableContextMenu.d.ts +21 -0
  187. package/dist/editor/plugins/tableContextMenu.js +88 -0
  188. package/dist/editor/plugins/textContextMenu.d.ts +15 -0
  189. package/dist/editor/plugins/textContextMenu.js +90 -0
  190. package/dist/editor/views/imageResize.d.ts +53 -0
  191. package/dist/editor/views/imageResize.js +167 -0
  192. package/dist/editor/views/runMarkView.d.ts +15 -0
  193. package/dist/editor/views/runMarkView.js +9 -0
  194. package/dist/editor/views/tableView.d.ts +24 -0
  195. package/dist/editor/views/tableView.js +32 -0
  196. package/dist/index.d.ts +44 -0
  197. package/dist/index.js +38 -0
  198. package/dist/model/format.d.ts +240 -0
  199. package/dist/model/format.js +305 -0
  200. package/dist/model/tabStops.d.ts +17 -0
  201. package/dist/model/tabStops.js +22 -0
  202. package/dist/numbering/listTemplate.d.ts +29 -0
  203. package/dist/numbering/listTemplate.js +83 -0
  204. package/dist/numbering/markers.d.ts +24 -0
  205. package/dist/numbering/markers.js +93 -0
  206. package/dist/numbering/parseNumbering.d.ts +65 -0
  207. package/dist/numbering/parseNumbering.js +116 -0
  208. package/dist/numbering/writeNumbering.d.ts +13 -0
  209. package/dist/numbering/writeNumbering.js +49 -0
  210. package/dist/ooxml/errors.d.ts +39 -0
  211. package/dist/ooxml/errors.js +21 -0
  212. package/dist/ooxml/image.d.ts +88 -0
  213. package/dist/ooxml/image.js +106 -0
  214. package/dist/ooxml/tabStops.d.ts +3 -0
  215. package/dist/ooxml/tabStops.js +51 -0
  216. package/dist/ooxml/units.d.ts +37 -0
  217. package/dist/ooxml/units.js +116 -0
  218. package/dist/ooxml/xml.d.ts +36 -0
  219. package/dist/ooxml/xml.js +89 -0
  220. package/dist/page/PageGuides.d.ts +16 -0
  221. package/dist/page/PageGuides.js +114 -0
  222. package/dist/page/measureBlocks.d.ts +25 -0
  223. package/dist/page/measureBlocks.js +80 -0
  224. package/dist/page/pageDecorations.d.ts +36 -0
  225. package/dist/page/pageDecorations.js +211 -0
  226. package/dist/page/pageLayout.d.ts +176 -0
  227. package/dist/page/pageLayout.js +157 -0
  228. package/dist/page/tableMeasurements.d.ts +10 -0
  229. package/dist/page/tableMeasurements.js +115 -0
  230. package/dist/page/usePageLayout.d.ts +57 -0
  231. package/dist/page/usePageLayout.js +141 -0
  232. package/dist/schema/docxSchema.d.ts +9 -0
  233. package/dist/schema/docxSchema.js +863 -0
  234. package/dist/schema/index.d.ts +2 -0
  235. package/dist/schema/index.js +9 -0
  236. package/dist/schema/locks.d.ts +112 -0
  237. package/dist/schema/locks.js +211 -0
  238. package/dist/schema/rendering.d.ts +6 -0
  239. package/dist/schema/rendering.js +46 -0
  240. package/dist/styles/classNames.d.ts +214 -0
  241. package/dist/styles/classNames.js +208 -0
  242. package/dist/styles/colors.d.ts +11 -0
  243. package/dist/styles/colors.js +14 -0
  244. package/dist/styles/fontSizes.d.ts +6 -0
  245. package/dist/styles/fontSizes.js +20 -0
  246. package/dist/styles/fontStack.d.ts +55 -0
  247. package/dist/styles/fontStack.js +262 -0
  248. package/dist/styles/fonts.d.ts +6 -0
  249. package/dist/styles/fonts.js +11 -0
  250. package/dist/styles/inlineStyle.d.ts +67 -0
  251. package/dist/styles/inlineStyle.js +212 -0
  252. package/dist/styles/lineSpacings.d.ts +11 -0
  253. package/dist/styles/lineSpacings.js +10 -0
  254. package/dist/styles.css +1650 -0
  255. package/dist/table/cellBorders.d.ts +12 -0
  256. package/dist/table/cellBorders.js +9 -0
  257. package/dist/table/cellFormatting.d.ts +57 -0
  258. package/dist/table/cellFormatting.js +173 -0
  259. package/dist/table/columns.d.ts +25 -0
  260. package/dist/table/columns.js +155 -0
  261. package/dist/table/commands.d.ts +19 -0
  262. package/dist/table/commands.js +63 -0
  263. package/dist/table/format.d.ts +35 -0
  264. package/dist/table/format.js +26 -0
  265. package/dist/table/gridBorders.d.ts +42 -0
  266. package/dist/table/gridBorders.js +192 -0
  267. package/dist/table/index.d.ts +16 -0
  268. package/dist/table/index.js +52 -0
  269. package/dist/table/merge.d.ts +36 -0
  270. package/dist/table/merge.js +125 -0
  271. package/dist/table/resize.d.ts +55 -0
  272. package/dist/table/resize.js +66 -0
  273. package/dist/table/rowResize.d.ts +14 -0
  274. package/dist/table/rowResize.js +44 -0
  275. package/dist/table/rows.d.ts +32 -0
  276. package/dist/table/rows.js +89 -0
  277. package/dist/table/widths.d.ts +69 -0
  278. package/dist/table/widths.js +97 -0
  279. package/dist/ui/AlignMenu.d.ts +15 -0
  280. package/dist/ui/AlignMenu.js +64 -0
  281. package/dist/ui/CellStyleGroup.d.ts +15 -0
  282. package/dist/ui/CellStyleGroup.js +232 -0
  283. package/dist/ui/ColorPicker.d.ts +13 -0
  284. package/dist/ui/ColorPicker.js +165 -0
  285. package/dist/ui/CommentsPanel.d.ts +15 -0
  286. package/dist/ui/CommentsPanel.js +348 -0
  287. package/dist/ui/FontFamilySelect.d.ts +14 -0
  288. package/dist/ui/FontFamilySelect.js +59 -0
  289. package/dist/ui/FontSizeSelect.d.ts +11 -0
  290. package/dist/ui/FontSizeSelect.js +49 -0
  291. package/dist/ui/InsertImageButton.d.ts +9 -0
  292. package/dist/ui/InsertImageButton.js +47 -0
  293. package/dist/ui/LinkCard.d.ts +12 -0
  294. package/dist/ui/LinkCard.js +127 -0
  295. package/dist/ui/LinkPanel.d.ts +9 -0
  296. package/dist/ui/LinkPanel.js +121 -0
  297. package/dist/ui/MenuChoice.d.ts +11 -0
  298. package/dist/ui/MenuChoice.js +32 -0
  299. package/dist/ui/NotesPanel.d.ts +6 -0
  300. package/dist/ui/NotesPanel.js +33 -0
  301. package/dist/ui/ParagraphStyleSelect.d.ts +11 -0
  302. package/dist/ui/ParagraphStyleSelect.js +62 -0
  303. package/dist/ui/Popover.d.ts +22 -0
  304. package/dist/ui/Popover.js +74 -0
  305. package/dist/ui/SpacingMenu.d.ts +12 -0
  306. package/dist/ui/SpacingMenu.js +54 -0
  307. package/dist/ui/TableMenu.d.ts +12 -0
  308. package/dist/ui/TableMenu.js +112 -0
  309. package/dist/ui/TableSizePicker.d.ts +9 -0
  310. package/dist/ui/TableSizePicker.js +53 -0
  311. package/dist/ui/TextMenu.d.ts +15 -0
  312. package/dist/ui/TextMenu.js +194 -0
  313. package/dist/ui/Toolbar.d.ts +19 -0
  314. package/dist/ui/Toolbar.js +448 -0
  315. package/dist/ui/ToolbarButton.d.ts +23 -0
  316. package/dist/ui/ToolbarButton.js +56 -0
  317. package/dist/ui/Tooltip.d.ts +19 -0
  318. package/dist/ui/Tooltip.js +47 -0
  319. package/dist/ui/ZoomSelect.d.ts +7 -0
  320. package/dist/ui/ZoomSelect.js +44 -0
  321. package/dist/ui/comments/CommentComposer.d.ts +17 -0
  322. package/dist/ui/comments/CommentComposer.js +59 -0
  323. package/dist/ui/comments/useCommentRailLayout.d.ts +18 -0
  324. package/dist/ui/comments/useCommentRailLayout.js +183 -0
  325. package/dist/ui/keyboardWalk.d.ts +22 -0
  326. package/dist/ui/keyboardWalk.js +70 -0
  327. package/dist/ui/openAddress.d.ts +11 -0
  328. package/dist/ui/openAddress.js +16 -0
  329. package/dist/ui/panelPlacement.d.ts +51 -0
  330. package/dist/ui/panelPlacement.js +71 -0
  331. package/dist/ui/presets.d.ts +11 -0
  332. package/dist/ui/presets.js +0 -0
  333. package/dist/ui/rovingFocus.d.ts +20 -0
  334. package/dist/ui/rovingFocus.js +61 -0
  335. package/dist/ui/runCommand.d.ts +5 -0
  336. package/dist/ui/runCommand.js +13 -0
  337. package/dist/ui/useDismiss.d.ts +6 -0
  338. package/dist/ui/useDismiss.js +31 -0
  339. package/dist/ui/useFitWidthZoom.d.ts +2 -0
  340. package/dist/ui/useFitWidthZoom.js +26 -0
  341. package/dist/ui/useGridKeyboard.d.ts +12 -0
  342. package/dist/ui/useGridKeyboard.js +90 -0
  343. package/dist/ui/useMenuKeyboard.d.ts +12 -0
  344. package/dist/ui/useMenuKeyboard.js +56 -0
  345. package/dist/ui/zoom.d.ts +4 -0
  346. package/dist/ui/zoom.js +21 -0
  347. package/package.json +120 -0
@@ -0,0 +1,110 @@
1
+ // src/editor/plugins/numberingDecorations.ts
2
+ import { Plugin, PluginKey } from "prosemirror-state";
3
+ import { Decoration, DecorationSet } from "prosemirror-view";
4
+ import { toParagraphFormat } from "../../model/format.js";
5
+ import { computeMarkers } from "../../numbering/markers.js";
6
+ import {
7
+ EMPTY_NUMBERING
8
+ } from "../../numbering/parseNumbering.js";
9
+ import { editorAttributes, editorCssVariables } from "../../styles/classNames.js";
10
+ var FALLBACK_MARKER_WIDTH_PT = 18;
11
+ function paragraphSpots(doc) {
12
+ const spots = [];
13
+ doc.descendants((node, pos) => {
14
+ if (node.type.name !== "paragraph") return true;
15
+ spots.push({
16
+ pos,
17
+ nodeSize: node.nodeSize,
18
+ format: toParagraphFormat(node.attrs.format)
19
+ });
20
+ return false;
21
+ });
22
+ return spots;
23
+ }
24
+ function markerPlacement(format, level) {
25
+ const ownTextIndentPt = format?.textIndentPt;
26
+ const textIndentPt = ownTextIndentPt ?? level.textIndentPt;
27
+ const hasOwnLeadingIndent = format?.indentLeftPt !== void 0 || format?.indentStartPt !== void 0;
28
+ const hasOwnTrailingIndent = format?.indentRightPt !== void 0 || format?.indentEndPt !== void 0;
29
+ return {
30
+ widthPt: textIndentPt !== null && textIndentPt !== void 0 && textIndentPt < 0 ? -textIndentPt : FALLBACK_MARKER_WIDTH_PT,
31
+ indentStartPt: hasOwnLeadingIndent ? null : level.startPt,
32
+ indentEndPt: hasOwnTrailingIndent ? null : level.endPt,
33
+ textIndentPt: ownTextIndentPt === void 0 ? level.textIndentPt : null
34
+ };
35
+ }
36
+ function paragraphMarkers(doc, numbering) {
37
+ const spots = paragraphSpots(doc);
38
+ const markers = computeMarkers(
39
+ spots.map((spot) => spot.format?.numbering ?? null),
40
+ numbering
41
+ );
42
+ return spots.flatMap((spot, index) => {
43
+ const marker = markers[index];
44
+ if (!marker) return [];
45
+ return [
46
+ {
47
+ from: spot.pos,
48
+ to: spot.pos + spot.nodeSize,
49
+ text: marker.text,
50
+ ...markerPlacement(spot.format, marker.indent)
51
+ }
52
+ ];
53
+ });
54
+ }
55
+ function markerStyle(marker) {
56
+ const css = [`${editorCssVariables.markerWidth}:${marker.widthPt}pt`];
57
+ if (marker.indentStartPt !== null) {
58
+ css.push(`margin-inline-start:${marker.indentStartPt}pt`);
59
+ }
60
+ if (marker.indentEndPt !== null) {
61
+ css.push(`margin-inline-end:${marker.indentEndPt}pt`);
62
+ }
63
+ if (marker.textIndentPt !== null) {
64
+ css.push(`text-indent:${marker.textIndentPt}pt`);
65
+ }
66
+ return css.join(";");
67
+ }
68
+ function markerDecorations(doc, numbering) {
69
+ const decorations = paragraphMarkers(doc, numbering).map(
70
+ (marker) => Decoration.node(marker.from, marker.to, {
71
+ [editorAttributes.listMarker]: marker.text,
72
+ style: markerStyle(marker)
73
+ })
74
+ );
75
+ return DecorationSet.create(doc, decorations);
76
+ }
77
+ var numberingKey = new PluginKey("docxEditorNumbering");
78
+ function documentNumbering(state) {
79
+ return numberingKey.getState(state)?.numbering ?? EMPTY_NUMBERING;
80
+ }
81
+ function canStartNewList(state) {
82
+ return numberingKey.getState(state)?.canStartNewList ?? true;
83
+ }
84
+ function numberingMarkers(numbering = EMPTY_NUMBERING, canStartNewList2 = true) {
85
+ return new Plugin({
86
+ key: numberingKey,
87
+ state: {
88
+ init: (_config, state) => ({
89
+ numbering,
90
+ canStartNewList: canStartNewList2,
91
+ decorations: markerDecorations(state.doc, numbering)
92
+ }),
93
+ apply: (tr, current) => tr.docChanged ? {
94
+ numbering,
95
+ canStartNewList: canStartNewList2,
96
+ decorations: markerDecorations(tr.doc, numbering)
97
+ } : current
98
+ },
99
+ props: {
100
+ decorations: (state) => numberingKey.getState(state)?.decorations
101
+ }
102
+ });
103
+ }
104
+ export {
105
+ canStartNewList,
106
+ documentNumbering,
107
+ markerDecorations,
108
+ numberingMarkers,
109
+ paragraphMarkers
110
+ };
@@ -0,0 +1,15 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ import { DecorationSet } from "prosemirror-view";
3
+ export interface RowEdgeHit {
4
+ row: number;
5
+ side: "top" | "bottom";
6
+ }
7
+ /** The row boundary under a pointer, including the end of a vertically merged cell. */
8
+ export declare function rowEdgeAt(clientY: number, cell: {
9
+ readonly top: number;
10
+ readonly bottom: number;
11
+ }, covered: {
12
+ readonly from: number;
13
+ readonly to: number;
14
+ }, tolerance?: number): RowEdgeHit | null;
15
+ export declare function rowResize(): Plugin<DecorationSet>;
@@ -0,0 +1,196 @@
1
+ // src/editor/plugins/rowResize.ts
2
+ import { Plugin, PluginKey } from "prosemirror-state";
3
+ import { TableMap } from "prosemirror-tables";
4
+ import { Decoration, DecorationSet } from "prosemirror-view";
5
+ import { isLockedCell } from "../../schema/locks.js";
6
+ import { editorClassNames } from "../../styles/classNames.js";
7
+ import {
8
+ buildResizeRowTransaction,
9
+ resizedRowHeight,
10
+ rowPositionAt
11
+ } from "../../table/rowResize.js";
12
+ var EDGE_TOLERANCE_PX = 4;
13
+ var rowResizeKey = new PluginKey("docxRowResize");
14
+ function rowEdgeAt(clientY, cell, covered, tolerance = EDGE_TOLERANCE_PX) {
15
+ if (Math.abs(clientY - cell.bottom) <= tolerance) {
16
+ return { row: covered.to - 1, side: "bottom" };
17
+ }
18
+ if (Math.abs(clientY - cell.top) <= tolerance && covered.from > 0) {
19
+ return { row: covered.from - 1, side: "top" };
20
+ }
21
+ return null;
22
+ }
23
+ function cellSpotAt(view, td) {
24
+ const $pos = view.state.doc.resolve(view.posAtDOM(td, 0));
25
+ for (let depth = $pos.depth; depth > 1; depth -= 1) {
26
+ const cell = $pos.node(depth);
27
+ if (cell.type.spec.tableRole !== "cell") continue;
28
+ const table = $pos.node(depth - 2);
29
+ if (table.type.spec.tableRole !== "table") return null;
30
+ const tablePos = $pos.before(depth - 2);
31
+ const rect = TableMap.get(table).findCell(
32
+ $pos.before(depth) - tablePos - 1
33
+ );
34
+ return { tablePos, table, from: rect.top, to: rect.bottom };
35
+ }
36
+ return null;
37
+ }
38
+ function edgeUnder(view, event) {
39
+ const node = event.target instanceof Node ? event.target : null;
40
+ const element = node instanceof Element ? node : node?.parentElement;
41
+ const td = element?.closest("td");
42
+ const tableDom = td?.closest("table");
43
+ if (!td || !tableDom || !view.dom.contains(td)) return null;
44
+ const spot = cellSpotAt(view, td);
45
+ if (!spot) return null;
46
+ const hit = rowEdgeAt(event.clientY, td.getBoundingClientRect(), spot);
47
+ if (!hit || hit.row < 0 || hit.row >= spot.table.childCount) return null;
48
+ const row = spot.table.child(hit.row);
49
+ if (row.children.some(isLockedCell)) return null;
50
+ const rowPos = rowPositionAt(spot.tablePos, spot.table, hit.row);
51
+ const rowDom = view.nodeDOM(rowPos);
52
+ if (!(rowDom instanceof HTMLTableRowElement)) return null;
53
+ return { ...spot, ...hit, tableDom, rowDom, rowPos };
54
+ }
55
+ function visualScale(view) {
56
+ const layer = view.dom.closest(`.${editorClassNames.pageLayer}`);
57
+ const raw = layer instanceof HTMLElement ? getComputedStyle(layer).zoom : "";
58
+ const parsed = Number.parseFloat(raw);
59
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;
60
+ }
61
+ function previewDecorations(doc, preview) {
62
+ const row = doc.nodeAt(preview.rowPos);
63
+ if (row?.type.spec.tableRole !== "row") return DecorationSet.empty;
64
+ return DecorationSet.create(doc, [
65
+ Decoration.node(preview.rowPos, preview.rowPos + row.nodeSize, {
66
+ style: `height:${preview.heightPt}pt !important`
67
+ })
68
+ ]);
69
+ }
70
+ function createGuide() {
71
+ const guide = document.createElement("div");
72
+ guide.className = editorClassNames.rowResizeGuide;
73
+ document.body.appendChild(guide);
74
+ return guide;
75
+ }
76
+ function moveGuide(drag) {
77
+ const table = drag.target.tableDom.getBoundingClientRect();
78
+ drag.guide.style.left = `${table.left}px`;
79
+ drag.guide.style.top = `${drag.target.rowDom.getBoundingClientRect().bottom}px`;
80
+ drag.guide.style.width = `${table.width}px`;
81
+ }
82
+ function showPreview(drag) {
83
+ drag.view.dispatch(
84
+ drag.view.state.tr.setMeta(rowResizeKey, {
85
+ rowPos: drag.target.rowPos,
86
+ heightPt: drag.heightPt
87
+ }).setMeta("addToHistory", false)
88
+ );
89
+ moveGuide(drag);
90
+ }
91
+ function hidePreview(drag) {
92
+ drag.view.dispatch(
93
+ drag.view.state.tr.setMeta(rowResizeKey, null).setMeta("addToHistory", false)
94
+ );
95
+ drag.guide.remove();
96
+ }
97
+ function rowResize() {
98
+ let drag = null;
99
+ function stop(clearPreview = true) {
100
+ if (!drag) return;
101
+ window.removeEventListener("mousemove", onMove, true);
102
+ window.removeEventListener("mouseup", onUp, true);
103
+ window.removeEventListener("keydown", onKey, true);
104
+ if (clearPreview) hidePreview(drag);
105
+ else drag.guide.remove();
106
+ drag.view.dom.classList.remove(editorClassNames.rowResize);
107
+ drag = null;
108
+ }
109
+ function onMove(event) {
110
+ if (!drag) return;
111
+ event.preventDefault();
112
+ drag.moved ||= event.clientY !== drag.startY;
113
+ drag.heightPt = resizedRowHeight(
114
+ drag.startHeightPt,
115
+ event.clientY - drag.startY,
116
+ drag.scale
117
+ );
118
+ showPreview(drag);
119
+ }
120
+ function onUp() {
121
+ const current = drag;
122
+ if (!current) return;
123
+ stop();
124
+ if (!current.moved) return;
125
+ const tr = buildResizeRowTransaction(current.view.state, {
126
+ tablePos: current.target.tablePos,
127
+ row: current.target.row,
128
+ heightPt: current.heightPt
129
+ });
130
+ if (tr) current.view.dispatch(tr);
131
+ }
132
+ function onKey(event) {
133
+ if (event.key !== "Escape") return;
134
+ event.preventDefault();
135
+ stop();
136
+ }
137
+ function start(view, event) {
138
+ const target = edgeUnder(view, event);
139
+ if (!target) return false;
140
+ const scale = visualScale(view);
141
+ const startHeightPt = target.rowDom.getBoundingClientRect().height / scale * (72 / 96);
142
+ drag = {
143
+ view,
144
+ target,
145
+ startY: event.clientY,
146
+ startHeightPt,
147
+ scale,
148
+ guide: createGuide(),
149
+ heightPt: startHeightPt,
150
+ moved: false
151
+ };
152
+ moveGuide(drag);
153
+ view.dom.classList.add(editorClassNames.rowResize);
154
+ window.addEventListener("mousemove", onMove, true);
155
+ window.addEventListener("mouseup", onUp, true);
156
+ window.addEventListener("keydown", onKey, true);
157
+ return true;
158
+ }
159
+ return new Plugin({
160
+ key: rowResizeKey,
161
+ state: {
162
+ init: () => DecorationSet.empty,
163
+ apply(tr, decorations) {
164
+ const preview = tr.getMeta(rowResizeKey);
165
+ if (preview === void 0) return decorations.map(tr.mapping, tr.doc);
166
+ return preview === null ? DecorationSet.empty : previewDecorations(tr.doc, preview);
167
+ }
168
+ },
169
+ view: () => ({ destroy: () => stop(false) }),
170
+ props: {
171
+ decorations: (state) => rowResizeKey.getState(state),
172
+ handleDOMEvents: {
173
+ mousemove(view, event) {
174
+ if (drag) return false;
175
+ const over = view.editable && edgeUnder(view, event) !== null;
176
+ view.dom.classList.toggle(editorClassNames.rowResize, over);
177
+ return false;
178
+ },
179
+ mouseleave(view) {
180
+ if (!drag) view.dom.classList.remove(editorClassNames.rowResize);
181
+ return false;
182
+ },
183
+ mousedown(view, event) {
184
+ if (!view.editable || drag || event.button !== 0) return false;
185
+ if (!start(view, event)) return false;
186
+ event.preventDefault();
187
+ return true;
188
+ }
189
+ }
190
+ }
191
+ });
192
+ }
193
+ export {
194
+ rowEdgeAt,
195
+ rowResize
196
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Applies inherited style display values to paragraphs created in the editor. The paragraph under
3
+ * active IME composition is deferred to avoid redrawing and canceling the composition.
4
+ */
5
+ import { Plugin } from "prosemirror-state";
6
+ /**
7
+ * Reads the document's styles into the paragraphs an edit built.
8
+ *
9
+ * No transaction of its own goes to the history: ProseMirror hands an appended transaction to the
10
+ * history as part of the same event, so a single undo takes the edit and these values back together.
11
+ *
12
+ * An appended transaction is handed nothing but states, so the view an open composition is read
13
+ * from is the one the plugin is given when it mounts.
14
+ */
15
+ export declare function styledParagraphs(): Plugin;
@@ -0,0 +1,65 @@
1
+ // src/editor/plugins/styledParagraphs.ts
2
+ import { Plugin } from "prosemirror-state";
3
+ import {
4
+ effectiveParagraphFormat,
5
+ effectiveParagraphStyle,
6
+ layerRunFormat
7
+ } from "../../docx/formatting.js";
8
+ import { docxSchema } from "../../schema/index.js";
9
+ import { documentParagraphFormatting } from "../documentStyles.js";
10
+ function needsFormatting(node) {
11
+ return node.attrs.format === null && node.attrs.styleRun === null;
12
+ }
13
+ function paragraphSpots(doc) {
14
+ const found = [];
15
+ doc.descendants((node, pos) => {
16
+ if (node.type !== docxSchema.nodes.paragraph) return true;
17
+ if (needsFormatting(node)) found.push({ pos, node });
18
+ return false;
19
+ });
20
+ return found;
21
+ }
22
+ function styledAttrs(node, state) {
23
+ const context = documentParagraphFormatting(state);
24
+ const style = effectiveParagraphStyle(node.attrs.pPr, context);
25
+ const format = effectiveParagraphFormat(node.attrs.pPr, context);
26
+ const styleRun = style ? layerRunFormat(style.run, null) : null;
27
+ return { ...node.attrs, format, styleRun };
28
+ }
29
+ function composingAt(view, state) {
30
+ return view?.composing === true ? state.selection.from : null;
31
+ }
32
+ function holdsComposition(paragraph, composing) {
33
+ return composing !== null && composing >= paragraph.pos && composing <= paragraph.pos + paragraph.node.nodeSize;
34
+ }
35
+ function styledParagraphs() {
36
+ let live = null;
37
+ return new Plugin({
38
+ view(view) {
39
+ live = view;
40
+ return {
41
+ destroy() {
42
+ live = null;
43
+ }
44
+ };
45
+ },
46
+ appendTransaction(transactions, _oldState, newState) {
47
+ if (!transactions.some((transaction) => transaction.docChanged)) {
48
+ return null;
49
+ }
50
+ const composing = composingAt(live, newState);
51
+ const tr = newState.tr;
52
+ for (const paragraph of paragraphSpots(newState.doc)) {
53
+ if (holdsComposition(paragraph, composing)) continue;
54
+ const attrs = styledAttrs(paragraph.node, newState);
55
+ if (!paragraph.node.hasMarkup(paragraph.node.type, attrs)) {
56
+ tr.setNodeMarkup(paragraph.pos, null, attrs);
57
+ }
58
+ }
59
+ return tr.docChanged ? tr : null;
60
+ }
61
+ });
62
+ }
63
+ export {
64
+ styledParagraphs
65
+ };
@@ -0,0 +1,3 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ /** Draws a caret from the model boundary because browsers disagree on a tab glyph's caret edge. */
3
+ export declare function tabCaret(): Plugin;
@@ -0,0 +1,126 @@
1
+ // src/editor/plugins/tabCaret.ts
2
+ import { Plugin } from "prosemirror-state";
3
+ import { docxSchema } from "../../schema/index.js";
4
+ import { editorClassNames } from "../../styles/classNames.js";
5
+ function isTab(node, edge) {
6
+ if (!node?.isText || !node.marks.some((mark) => mark.type === docxSchema.marks.tab)) {
7
+ return false;
8
+ }
9
+ return edge === "start" ? node.text?.startsWith(" ") === true : node.text?.endsWith(" ") === true;
10
+ }
11
+ function tabBoundary(view) {
12
+ const { selection } = view.state;
13
+ if (!selection.empty) return null;
14
+ const position = selection.head;
15
+ const resolved = view.state.doc.resolve(position);
16
+ if (isTab(resolved.nodeAfter, "start")) return { position, side: "before" };
17
+ if (isTab(resolved.nodeBefore, "end")) {
18
+ return { position: position - 1, side: "after" };
19
+ }
20
+ return null;
21
+ }
22
+ function tabSlot(view, position) {
23
+ return view.dom.querySelector(
24
+ `.${editorClassNames.tabSlot}[data-tab-position="${position}"]`
25
+ );
26
+ }
27
+ function tabCaret() {
28
+ return new Plugin({
29
+ view(view) {
30
+ const ownerDocument = view.dom.ownerDocument;
31
+ const ownerWindow = ownerDocument.defaultView;
32
+ const caret = ownerDocument.createElement("div");
33
+ caret.className = editorClassNames.tabCaret;
34
+ caret.hidden = true;
35
+ caret.setAttribute("aria-hidden", "true");
36
+ ownerDocument.body.append(caret);
37
+ let frame = 0;
38
+ let live = true;
39
+ const requestFrame = ownerWindow?.requestAnimationFrame.bind(ownerWindow);
40
+ const cancelFrame = ownerWindow?.cancelAnimationFrame.bind(ownerWindow);
41
+ const hide = () => {
42
+ caret.hidden = true;
43
+ view.dom.classList.remove(editorClassNames.tabCaretActive);
44
+ };
45
+ const draw = () => {
46
+ frame = 0;
47
+ if (!live || !view.hasFocus()) {
48
+ hide();
49
+ return;
50
+ }
51
+ const boundary = tabBoundary(view);
52
+ const slot = boundary && tabSlot(view, boundary.position);
53
+ if (!boundary || !slot || !slot.hasAttribute("data-tab-layout")) {
54
+ hide();
55
+ return;
56
+ }
57
+ const slotRect = slot.getBoundingClientRect();
58
+ const paragraph = slot.closest(`.${editorClassNames.paragraph}`);
59
+ const style = ownerWindow?.getComputedStyle(paragraph ?? slot);
60
+ const rtl = style?.direction === "rtl";
61
+ const leading = boundary.side === "before";
62
+ const left = leading === !rtl ? slotRect.left : slotRect.right;
63
+ const coordinates = view.coordsAtPos(view.state.selection.head);
64
+ const height = Math.max(1, coordinates.bottom - coordinates.top);
65
+ caret.style.color = ownerWindow?.getComputedStyle(slot).color ?? "currentcolor";
66
+ caret.style.left = `${left}px`;
67
+ caret.style.top = `${coordinates.top}px`;
68
+ caret.style.height = `${height}px`;
69
+ caret.hidden = false;
70
+ view.dom.classList.add(editorClassNames.tabCaretActive);
71
+ };
72
+ const schedule = () => {
73
+ if (!live || frame !== 0) return;
74
+ frame = (requestFrame ?? requestAnimationFrame)(draw);
75
+ };
76
+ const onFocus = () => schedule();
77
+ const onBlur = () => hide();
78
+ const onViewportChange = () => schedule();
79
+ const layer = view.dom.closest(`.${editorClassNames.pageLayer}`);
80
+ const root = view.dom.closest(`.${editorClassNames.root}`);
81
+ const workspace = view.dom.closest(`.${editorClassNames.workspace}`);
82
+ const ResizeObserverClass = ownerWindow?.ResizeObserver;
83
+ const resize = typeof ResizeObserverClass === "undefined" ? null : new ResizeObserverClass(schedule);
84
+ resize?.observe(view.dom);
85
+ if (root) resize?.observe(root);
86
+ if (workspace) resize?.observe(workspace);
87
+ const MutationObserverClass = ownerWindow?.MutationObserver;
88
+ const layoutMutation = typeof MutationObserverClass === "undefined" ? null : new MutationObserverClass(schedule);
89
+ if (layer) {
90
+ layoutMutation?.observe(layer, {
91
+ attributes: true,
92
+ attributeFilter: ["class", "style"]
93
+ });
94
+ }
95
+ if (workspace) {
96
+ layoutMutation?.observe(workspace, {
97
+ attributes: true,
98
+ attributeFilter: ["class", "data-comments", "style"]
99
+ });
100
+ }
101
+ view.dom.addEventListener("focus", onFocus);
102
+ view.dom.addEventListener("blur", onBlur);
103
+ ownerDocument.addEventListener("scroll", onViewportChange, true);
104
+ ownerWindow?.addEventListener("resize", onViewportChange);
105
+ schedule();
106
+ return {
107
+ update: () => schedule(),
108
+ destroy() {
109
+ live = false;
110
+ if (frame !== 0) (cancelFrame ?? cancelAnimationFrame)(frame);
111
+ view.dom.removeEventListener("focus", onFocus);
112
+ view.dom.removeEventListener("blur", onBlur);
113
+ ownerDocument.removeEventListener("scroll", onViewportChange, true);
114
+ ownerWindow?.removeEventListener("resize", onViewportChange);
115
+ resize?.disconnect();
116
+ layoutMutation?.disconnect();
117
+ view.dom.classList.remove(editorClassNames.tabCaretActive);
118
+ caret.remove();
119
+ }
120
+ };
121
+ }
122
+ });
123
+ }
124
+ export {
125
+ tabCaret
126
+ };
@@ -0,0 +1,11 @@
1
+ import { type EditorState, Plugin, type Transaction } from "prosemirror-state";
2
+ import { DecorationSet } from "prosemirror-view";
3
+ interface TabDecorationState {
4
+ widths: ReadonlyMap<number, number>;
5
+ decorations: DecorationSet;
6
+ }
7
+ export declare function tabWidths(state: EditorState): ReadonlyMap<number, number>;
8
+ export declare function setTabWidths(transaction: Transaction, widths: ReadonlyMap<number, number>): Transaction;
9
+ /** Gives every tab character an independent DOM range without changing the document model. */
10
+ export declare function tabDecorations(): Plugin<TabDecorationState>;
11
+ export {};
@@ -0,0 +1,87 @@
1
+ // src/editor/plugins/tabDecorations.ts
2
+ import {
3
+ Plugin,
4
+ PluginKey
5
+ } from "prosemirror-state";
6
+ import { Decoration, DecorationSet } from "prosemirror-view";
7
+ import { editorClassNames, editorCssVariables } from "../../styles/classNames.js";
8
+ var tabDecorationsKey = new PluginKey(
9
+ "docxEditorTabDecorations"
10
+ );
11
+ function decorationsFor(doc, widths) {
12
+ const decorations = [];
13
+ doc.descendants((node, pos) => {
14
+ if (!node.isText || !node.text?.includes(" ")) return true;
15
+ for (let offset = 0; offset < node.text.length; offset += 1) {
16
+ if (node.text[offset] !== " ") continue;
17
+ const from = pos + offset;
18
+ const width = widths.get(from);
19
+ const attrs = {
20
+ class: editorClassNames.tabSlot,
21
+ // Distinct attributes prevent adjacent ranges from sharing one DOM wrapper.
22
+ "data-tab-position": `${from}`
23
+ };
24
+ if (width !== void 0) {
25
+ attrs["data-tab-layout"] = "";
26
+ attrs.style = `${editorCssVariables.tabWidth}:${Math.max(0, width)}px`;
27
+ }
28
+ decorations.push(
29
+ Decoration.inline(from, from + 1, attrs, {
30
+ inclusiveStart: false,
31
+ inclusiveEnd: false
32
+ })
33
+ );
34
+ }
35
+ return true;
36
+ });
37
+ return DecorationSet.create(doc, decorations);
38
+ }
39
+ function characterAt(doc, position) {
40
+ return doc.textBetween(position, position + 1, "", "");
41
+ }
42
+ function mappedWidths(transaction, widths) {
43
+ const mapped = /* @__PURE__ */ new Map();
44
+ for (const [position, width] of widths) {
45
+ const result = transaction.mapping.mapResult(position, 1);
46
+ if (!result.deleted && result.pos < transaction.doc.content.size && characterAt(transaction.doc, result.pos) === " ") {
47
+ mapped.set(result.pos, width);
48
+ }
49
+ }
50
+ return mapped;
51
+ }
52
+ function tabWidths(state) {
53
+ return tabDecorationsKey.getState(state)?.widths ?? /* @__PURE__ */ new Map();
54
+ }
55
+ function setTabWidths(transaction, widths) {
56
+ return transaction.setMeta(tabDecorationsKey, widths);
57
+ }
58
+ function tabDecorations() {
59
+ return new Plugin({
60
+ key: tabDecorationsKey,
61
+ state: {
62
+ init: (_config, state) => {
63
+ const widths = /* @__PURE__ */ new Map();
64
+ return { widths, decorations: decorationsFor(state.doc, widths) };
65
+ },
66
+ apply(transaction, current, _oldState, newState) {
67
+ const supplied = transaction.getMeta(tabDecorationsKey);
68
+ if (!transaction.docChanged && !(supplied instanceof Map)) {
69
+ return current;
70
+ }
71
+ const widths = supplied instanceof Map ? supplied : mappedWidths(transaction, current.widths);
72
+ return {
73
+ widths,
74
+ decorations: decorationsFor(newState.doc, widths)
75
+ };
76
+ }
77
+ },
78
+ props: {
79
+ decorations: (state) => tabDecorationsKey.getState(state)?.decorations ?? null
80
+ }
81
+ });
82
+ }
83
+ export {
84
+ setTabWidths,
85
+ tabDecorations,
86
+ tabWidths
87
+ };
@@ -0,0 +1,16 @@
1
+ import { Plugin } from "prosemirror-state";
2
+ import type { TabAlignment, TabStop } from "../../model/tabStops";
3
+ type PositionedAlignment = Exclude<TabAlignment, "num">;
4
+ export interface TabTarget {
5
+ align: PositionedAlignment;
6
+ targetPt: number;
7
+ }
8
+ export declare function nextTabTarget(currentPt: number, stops: readonly TabStop[], defaultStopPt: number): TabTarget;
9
+ export interface TabSegmentMetrics {
10
+ wholePt: number;
11
+ decimalPrefixPt: number;
12
+ }
13
+ export declare function tabAdvancePt(currentPt: number, target: TabTarget, segment: TabSegmentMetrics): number;
14
+ /** Resolves tab widths against the paragraph's OOXML coordinate system. */
15
+ export declare function tabLayout(): Plugin;
16
+ export {};