@stll/folio-core 0.63.0 → 0.63.1

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 (205) hide show
  1. package/dist/ai-edits/headless.d.ts +5 -4
  2. package/dist/ai-edits/headless.js +10 -67
  3. package/dist/compare/content.d.ts +7 -7
  4. package/dist/compare/content.js +6 -3
  5. package/dist/compare/types.d.ts +15 -14
  6. package/dist/compare/types.js +14 -7
  7. package/dist/content-controls/errors.d.ts +7 -6
  8. package/dist/content-controls/errors.js +6 -3
  9. package/dist/controller/canonicalComments.d.ts +4 -3
  10. package/dist/controller/canonicalComments.js +2 -1
  11. package/dist/controller/canonicalInlineProjection.d.ts +3 -3
  12. package/dist/controller/canonicalInlineProjection.js +2 -1
  13. package/dist/controller/canonicalListRendering.d.ts +5 -3
  14. package/dist/controller/canonicalPublicOperations.js +2 -1
  15. package/dist/controller/canonicalSession.d.ts +5 -5
  16. package/dist/controller/canonicalSession.js +2 -1
  17. package/dist/controller/hiddenEditorManager.d.ts +3 -2
  18. package/dist/controller/hiddenEditorManager.js +2 -1
  19. package/dist/document-operations.d.ts +5 -4
  20. package/dist/document-operations.js +4 -2
  21. package/dist/docx/appVersionNormalization.d.ts +3 -2
  22. package/dist/docx/appVersionNormalization.js +2 -1
  23. package/dist/docx/attributeRemainder.d.ts +3 -2
  24. package/dist/docx/attributeRemainder.js +2 -1
  25. package/dist/docx/canonicalResourceSave.d.ts +3 -2
  26. package/dist/docx/canonicalResourceSave.js +2 -1
  27. package/dist/docx/canonicalSave.d.ts +6 -4
  28. package/dist/docx/canonicalSave.js +2 -1
  29. package/dist/docx/canonicalSessionInput.d.ts +4 -3
  30. package/dist/docx/canonicalSessionInput.js +2 -1
  31. package/dist/docx/encryption/errors.d.ts +3 -2
  32. package/dist/docx/encryption/errors.js +2 -1
  33. package/dist/docx/ensureParaIds.d.ts +3 -2
  34. package/dist/docx/ensureParaIds.js +2 -1
  35. package/dist/docx/headerFooterVerbatim.d.ts +2 -2
  36. package/dist/docx/imageParser.d.ts +1 -1
  37. package/dist/docx/index.d.ts +1 -0
  38. package/dist/docx/linkedSdtPreservation.d.ts +5 -3
  39. package/dist/docx/linkedSdtPreservation.js +2 -1
  40. package/dist/docx/metadataPrivacy.d.ts +5 -4
  41. package/dist/docx/metadataPrivacy.js +4 -2
  42. package/dist/docx/numericIdAllocator.js +2 -1
  43. package/dist/docx/paragraphPropertySource.d.ts +3 -2
  44. package/dist/docx/paragraphPropertySource.js +2 -1
  45. package/dist/docx/parser.d.ts +3 -2
  46. package/dist/docx/parser.js +2 -1
  47. package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
  48. package/dist/docx/reviewResolutionProvenance.js +2 -1
  49. package/dist/docx/revisionIdNormalization.d.ts +3 -2
  50. package/dist/docx/revisionIdNormalization.js +2 -1
  51. package/dist/docx/rezip.d.ts +5 -4
  52. package/dist/docx/rezip.js +4 -2
  53. package/dist/docx/sectionReferenceHistory.d.ts +3 -2
  54. package/dist/docx/sectionReferenceHistory.js +2 -1
  55. package/dist/docx/serializer/paragraphSerializer.js +6 -3
  56. package/dist/docx/serializer/partNamespaces.d.ts +3 -2
  57. package/dist/docx/serializer/partNamespaces.js +2 -1
  58. package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +5 -4
  59. package/dist/docx/server/applyDocxXmlPatchProposal.js +4 -2
  60. package/dist/docx/server/boundedArchive.d.ts +3 -2
  61. package/dist/docx/server/boundedArchive.js +2 -1
  62. package/dist/docx/server/build.d.ts +3 -2
  63. package/dist/docx/server/build.js +2 -1
  64. package/dist/docx/server/createBilingualDocument.d.ts +3 -2
  65. package/dist/docx/server/createBilingualDocument.js +4 -2
  66. package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +5 -4
  67. package/dist/docx/server/evaluateDocxXmlPatchProposal.js +4 -2
  68. package/dist/docx/server/inspectDocxPackage.d.ts +3 -2
  69. package/dist/docx/server/inspectDocxPackage.js +2 -1
  70. package/dist/docx/server/materializeYjsDocx.d.ts +3 -2
  71. package/dist/docx/server/materializeYjsDocx.js +2 -1
  72. package/dist/docx/server/migrateYjsAttrSchema.d.ts +3 -3
  73. package/dist/docx/server/migrateYjsAttrSchema.js +2 -1
  74. package/dist/docx/tableParser.d.ts +4 -4
  75. package/dist/docx/verbatimCapture.d.ts +3 -2
  76. package/dist/docx/verbatimCapture.js +2 -1
  77. package/dist/docx/xmlResourceLimits.d.ts +3 -2
  78. package/dist/docx/xmlResourceLimits.js +5 -2
  79. package/dist/export-pdf.d.ts +3 -3
  80. package/dist/export-pdf.js +2 -1
  81. package/dist/fonts/headlessMeasure.d.ts +3 -3
  82. package/dist/fonts/headlessMeasure.js +2 -1
  83. package/dist/fonts/sfnt/parse.d.ts +3 -3
  84. package/dist/fonts/sfnt/parse.js +2 -1
  85. package/dist/fonts/sfnt/subset.d.ts +3 -3
  86. package/dist/fonts/sfnt/subset.js +2 -1
  87. package/dist/fonts/sfnt/tables.d.ts +3 -3
  88. package/dist/fonts/sfnt/tables.js +2 -1
  89. package/dist/fonts/sfnt/woff.d.ts +3 -3
  90. package/dist/fonts/sfnt/woff.js +2 -1
  91. package/dist/headless-layout.d.ts +3 -3
  92. package/dist/headless-layout.js +2 -1
  93. package/dist/layout-engine/measure/font-metrics.worker.js +2 -1
  94. package/dist/layout-engine/measure/hyphenationDictionaries.d.ts +3 -20
  95. package/dist/layout-engine/measure/hyphenationDictionaries.js +2 -1
  96. package/dist/layout-engine/section-breaks.d.ts +1 -1
  97. package/dist/pdf/fonts.js +2 -1
  98. package/dist/pdf/images.d.ts +3 -3
  99. package/dist/pdf/images.js +2 -1
  100. package/dist/pdf/paint.d.ts +3 -3
  101. package/dist/pdf/paint.js +2 -1
  102. package/dist/pdf/writePdf.d.ts +3 -3
  103. package/dist/pdf/writePdf.js +2 -1
  104. package/dist/prosemirror/canonicalCommands.d.ts +9 -9
  105. package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +15 -14
  106. package/dist/prosemirror/commentIdAllocator.d.ts +3 -2
  107. package/dist/prosemirror/commentIdAllocator.js +2 -1
  108. package/dist/prosemirror/conversion/fromProseDoc.js +4 -2
  109. package/dist/prosemirror/extensions/core/DocExtension.d.ts +0 -3
  110. package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +0 -3
  111. package/dist/prosemirror/extensions/core/TextExtension.d.ts +0 -3
  112. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +2 -2
  113. package/dist/prosemirror/extensions/features/BidiShortcutExtension.d.ts +0 -10
  114. package/dist/prosemirror/extensions/features/ContentControlWidgetsExtension.d.ts +0 -10
  115. package/dist/prosemirror/extensions/features/DropCursorExtension.d.ts +0 -6
  116. package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.d.ts +4 -4
  117. package/dist/prosemirror/extensions/features/GapCursorExtension.d.ts +0 -13
  118. package/dist/prosemirror/extensions/features/ImageDragExtension.d.ts +0 -9
  119. package/dist/prosemirror/extensions/features/ImagePasteExtension.d.ts +0 -6
  120. package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +0 -14
  121. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +3 -2
  122. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +77 -46
  123. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -2
  124. package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +0 -17
  125. package/dist/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts +0 -14
  126. package/dist/prosemirror/extensions/marks/AllCapsExtension.d.ts +0 -3
  127. package/dist/prosemirror/extensions/marks/BoldExtension.d.ts +0 -3
  128. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts +0 -8
  129. package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +0 -14
  130. package/dist/prosemirror/extensions/marks/CommentExtension.d.ts +0 -6
  131. package/dist/prosemirror/extensions/marks/FontFamilyExtension.d.ts +0 -3
  132. package/dist/prosemirror/extensions/marks/FontSizeExtension.d.ts +0 -3
  133. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.d.ts +0 -5
  134. package/dist/prosemirror/extensions/marks/HiddenTextExtension.d.ts +0 -17
  135. package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +0 -12
  136. package/dist/prosemirror/extensions/marks/ItalicExtension.d.ts +0 -3
  137. package/dist/prosemirror/extensions/marks/SmallCapsExtension.d.ts +0 -3
  138. package/dist/prosemirror/extensions/marks/StrikeExtension.d.ts +0 -3
  139. package/dist/prosemirror/extensions/marks/SubscriptExtension.d.ts +0 -3
  140. package/dist/prosemirror/extensions/marks/SuperscriptExtension.d.ts +0 -3
  141. package/dist/prosemirror/extensions/marks/TextColorExtension.d.ts +0 -3
  142. package/dist/prosemirror/extensions/marks/TextEffectsExtensions.d.ts +0 -6
  143. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +0 -7
  144. package/dist/prosemirror/extensions/marks/UnderlineExtension.d.ts +0 -3
  145. package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -7
  146. package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +0 -22
  147. package/dist/prosemirror/extensions/nodes/BlockMoveRangeBoundaryExtension.d.ts +0 -14
  148. package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +0 -17
  149. package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.d.ts +0 -1
  150. package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +0 -8
  151. package/dist/prosemirror/extensions/nodes/HardBreakExtension.d.ts +0 -3
  152. package/dist/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts +0 -3
  153. package/dist/prosemirror/extensions/nodes/ImageExtension.d.ts +0 -3
  154. package/dist/prosemirror/extensions/nodes/MathExtension.d.ts +0 -7
  155. package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +0 -1
  156. package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +0 -3
  157. package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.d.ts +0 -1
  158. package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +0 -25
  159. package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +0 -9
  160. package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +0 -1
  161. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +0 -1
  162. package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +0 -6
  163. package/dist/prosemirror/extensions/nodes/TabExtension.d.ts +0 -3
  164. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +0 -7
  165. package/dist/prosemirror/hyperlinkRemoval.d.ts +3 -2
  166. package/dist/prosemirror/hyperlinkRemoval.js +2 -1
  167. package/dist/prosemirror/markupViewProjection.d.ts +3 -3
  168. package/dist/prosemirror/noteReferenceOccurrences.d.ts +6 -5
  169. package/dist/prosemirror/noteReferenceOccurrences.js +4 -2
  170. package/dist/prosemirror/numberingAttr.d.ts +5 -5
  171. package/dist/prosemirror/plugins/aiCitationDecorations.d.ts +4 -4
  172. package/dist/prosemirror/plugins/aiSuggestionDecorations.d.ts +4 -4
  173. package/dist/prosemirror/plugins/anonymizationDecorations.d.ts +2 -2
  174. package/dist/prosemirror/plugins/autocompleteSuggestion.d.ts +2 -2
  175. package/dist/prosemirror/plugins/contentControlWidgets.d.ts +4 -4
  176. package/dist/prosemirror/plugins/documentStyleState.d.ts +4 -4
  177. package/dist/prosemirror/plugins/revisionIds.d.ts +3 -2
  178. package/dist/prosemirror/plugins/revisionIds.js +2 -1
  179. package/dist/prosemirror/plugins/selectionTracker.d.ts +2 -2
  180. package/dist/prosemirror/plugins/suggestionMode.d.ts +2 -2
  181. package/dist/prosemirror/plugins/templateDirectives.d.ts +5 -5
  182. package/dist/prosemirror/plugins/templatePreviewValues.d.ts +4 -4
  183. package/dist/prosemirror/plugins/templateSlashMenu.d.ts +2 -2
  184. package/dist/prosemirror/preservedXmlReview.d.ts +2 -2
  185. package/dist/prosemirror/runStyleFormatting.d.ts +7 -7
  186. package/dist/prosemirror/schema/index.d.ts +2 -1
  187. package/dist/prosemirror/schema/index.js +0 -7
  188. package/dist/prosemirror/styles/styleResolver.d.ts +1 -1
  189. package/dist/prosemirror/textInput.d.ts +3 -2
  190. package/dist/prosemirror/yjsDocumentMetadata.d.ts +8 -8
  191. package/dist/prosemirror/yjsDocumentMetadata.js +6 -3
  192. package/dist/redline.d.ts +5 -4
  193. package/dist/redline.js +4 -2
  194. package/dist/redlineOperationLimit.d.ts +3 -2
  195. package/dist/redlineOperationLimit.js +2 -1
  196. package/dist/render-dom/commentAnchorAttributes.d.ts +1 -1
  197. package/dist/shaping/shaper.d.ts +3 -21
  198. package/dist/shaping/shaper.js +2 -1
  199. package/dist/utils/clipboard.d.ts +2 -2
  200. package/dist/utils/clipboard.js +2 -2
  201. package/dist/utils/formatToStyle.d.ts +1 -1
  202. package/dist/utils/units.d.ts +1 -1
  203. package/dist/version-comparison.d.ts +3 -2
  204. package/dist/version-comparison.js +2 -1
  205. package/package.json +3 -3
@@ -27,7 +27,10 @@ import { Plugin, Transaction } from "prosemirror-state";
27
27
  * ids in an `appendTransaction` hook after every doc-changed step.
28
28
  *
29
29
  * Id lifecycle rules (locked by the co-located tests):
30
- * - Missing/empty/reserved-zero id: a fresh random id is minted.
30
+ * - Load: a missing/empty/reserved-zero or duplicate id gets one derived
31
+ * from the paragraph's text and ordinal (`ensureParaIdsInDoc`), the same
32
+ * id the headless reviewer derives for the same document.
33
+ * - Missing/empty/reserved-zero id after an edit: a fresh random id is minted.
31
34
  * - Split: the half holding the paragraph's original start position
32
35
  * keeps the id; the other half gets a fresh one. Anchors inside the
33
36
  * content stay resolvable on the half that carries them.
@@ -207,7 +210,6 @@ const collectParaIdUpdatesFromCensus = (census, keeperPositions, deterministicSe
207
210
  updates.sort((left, right) => left.pos - right.pos);
208
211
  return updates;
209
212
  };
210
- const collectParaIdUpdates = (doc) => collectParaIdUpdatesFromCensus(collectParagraphCensus(doc));
211
213
  const collectParagraphPropertySourceUpdates = (census, keeperPositions, transactions) => {
212
214
  const updates = /* @__PURE__ */ new Map();
213
215
  for (const { pos } of census.invalidSourceTokens) updates.set(pos, null);
@@ -237,49 +239,49 @@ const collectParagraphPropertySourceUpdates = (census, keeperPositions, transact
237
239
  token
238
240
  })).sort((left, right) => left.pos - right.pos);
239
241
  };
240
- const collectInitialParaIds = (doc) => {
241
- let needsRewrite = false;
242
+ /**
243
+ * The ids a loaded document's paragraphs take, in document order: `null`
244
+ * keeps the paragraph's own id, a string replaces it.
245
+ *
246
+ * This is the only load-time allocator. The live editor and the headless
247
+ * reviewer both seed through it, so the same document gives the same block ids
248
+ * on either side: an id read from the editor resolves when the edit is applied
249
+ * headlessly, and re-parsing the same bytes mints the same ids. An id is
250
+ * derived from the paragraph's text and its document ordinal, never drawn at
251
+ * random. Authored ids are reserved first, so a minted id never takes one a
252
+ * later paragraph owns; of a duplicated authored id, the first occurrence
253
+ * keeps it.
254
+ */
255
+ const planLoadParaIds = (doc) => {
256
+ const paragraphs = [];
242
257
  const taken = /* @__PURE__ */ new Set();
243
258
  doc.descendants((node) => {
244
259
  if (node.type.name !== "paragraph") return true;
260
+ paragraphs.push(node);
245
261
  const id = node.attrs["paraId"];
246
- if (!isUsableParaId(id) || taken.has(id)) needsRewrite = true;
247
- else taken.add(id);
262
+ if (isUsableParaId(id)) taken.add(id);
248
263
  return false;
249
264
  });
250
- return {
251
- needsRewrite,
252
- taken
253
- };
254
- };
255
- const rewriteInitialParaIds = (parent, taken, seen) => {
256
- let changed = false;
257
- const children = [];
258
- parent.forEach((child) => {
259
- let next = child;
260
- if (child.type.name === "paragraph") {
261
- const id = child.attrs["paraId"];
262
- if (!isUsableParaId(id) || seen.has(id)) {
263
- let newId = generateHexId();
264
- while (taken.has(newId)) newId = generateHexId();
265
- taken.add(newId);
266
- seen.add(newId);
267
- next = recreateProseNodeWithParagraphPropertySource(child, { attrs: {
268
- ...child.attrs,
269
- paraId: newId
270
- } });
271
- } else seen.add(id);
272
- const paraId = next.attrs["paraId"];
273
- if (typeof paraId === "string") transferProseParagraphPropertySource(next, child, paraId);
274
- } else if (child.childCount > 0) {
275
- const content = rewriteInitialParaIds(child, taken, seen);
276
- if (content !== child.content) next = recreateProseNodeWithParagraphPropertySource(child, { content });
265
+ const kept = /* @__PURE__ */ new Set();
266
+ return paragraphs.map((paragraph, index) => {
267
+ const id = paragraph.attrs["paraId"];
268
+ if (isUsableParaId(id) && !kept.has(id)) {
269
+ kept.add(id);
270
+ return null;
277
271
  }
278
- if (next !== child) changed = true;
279
- children.push(next);
272
+ const seed = `${paragraph.textContent}:${String(index + 1)}`;
273
+ let minted = deterministicHexId(seed);
274
+ for (let salt = 1; taken.has(minted); salt++) minted = deterministicHexId(`${seed}:${String(salt)}`);
275
+ taken.add(minted);
276
+ return minted;
280
277
  });
281
- return changed ? Fragment.fromArray(children) : parent.content;
282
278
  };
279
+ /** A paragraph's attrs once it holds an id folio minted rather than read. */
280
+ const mintedParagraphAttrs = (paragraph, paraId) => ({
281
+ ...paragraph.attrs,
282
+ paraId,
283
+ ...paragraph.type.spec.attrs?.["idStability"] !== void 0 && { idStability: "positional" }
284
+ });
283
285
  /**
284
286
  * Allocate initial paragraph IDs before constructing editor state.
285
287
  *
@@ -288,19 +290,48 @@ const rewriteInitialParaIds = (parent, taken, seen) => {
288
290
  * below so history, mappings, and duplicate ownership retain their semantics.
289
291
  */
290
292
  const ensureParaIdsInDoc = (doc) => {
291
- const { needsRewrite, taken } = collectInitialParaIds(doc);
292
- if (!needsRewrite) return doc;
293
- return recreateProseNodeWithParagraphPropertySource(doc, { content: rewriteInitialParaIds(doc, taken, /* @__PURE__ */ new Set()) });
293
+ const plan = planLoadParaIds(doc);
294
+ if (plan.every((paraId) => paraId === null)) return doc;
295
+ let ordinal = 0;
296
+ const rewrite = (parent) => {
297
+ let changed = false;
298
+ const children = [];
299
+ parent.forEach((child) => {
300
+ let next = child;
301
+ if (child.type.name === "paragraph") {
302
+ const minted = plan[ordinal];
303
+ ordinal += 1;
304
+ if (minted !== null && minted !== void 0) next = recreateProseNodeWithParagraphPropertySource(child, { attrs: mintedParagraphAttrs(child, minted) });
305
+ const paraId = next.attrs["paraId"];
306
+ if (typeof paraId === "string") transferProseParagraphPropertySource(next, child, paraId);
307
+ } else if (child.childCount > 0) {
308
+ const content = rewrite(child);
309
+ if (content !== child.content) next = recreateProseNodeWithParagraphPropertySource(child, { content });
310
+ }
311
+ if (next !== child) changed = true;
312
+ children.push(next);
313
+ });
314
+ return changed ? Fragment.fromArray(children) : parent.content;
315
+ };
316
+ return recreateProseNodeWithParagraphPropertySource(doc, { content: rewrite(doc) });
294
317
  };
318
+ /** {@link ensureParaIdsInDoc} for a state that already exists. */
295
319
  const ensureParaIdsInState = (state) => {
296
- const updates = collectParaIdUpdates(state.doc);
297
- if (updates.length === 0) return state;
320
+ const plan = planLoadParaIds(state.doc);
321
+ if (plan.every((paraId) => paraId === null)) return state;
298
322
  const tr = state.tr;
299
- for (const update of updates) setProseParagraphMarkupWithPropertySource({
300
- attrs: update.attrs,
301
- ownership: "transfer-allocated-id",
302
- pos: update.pos,
303
- transaction: tr
323
+ let ordinal = 0;
324
+ state.doc.descendants((node, pos) => {
325
+ if (node.type.name !== "paragraph") return true;
326
+ const minted = plan[ordinal];
327
+ ordinal += 1;
328
+ if (minted !== null && minted !== void 0) setProseParagraphMarkupWithPropertySource({
329
+ attrs: mintedParagraphAttrs(node, minted),
330
+ ownership: "transfer-allocated-id",
331
+ pos,
332
+ transaction: tr
333
+ });
334
+ return false;
304
335
  });
305
336
  ignoreTrackedChanges(tr);
306
337
  tr.setMeta(paraIdAllocatorKey, "allocated");
@@ -2,11 +2,11 @@ import { document_d_exports } from "../../../types/document.js";
2
2
  import { Extension } from "../types.js";
3
3
  import { RemovedSectionReference, TrackedSectionEndpointRemoval } from "../../../internal/sectionEndpointResolution.js";
4
4
  import { Node } from "prosemirror-model";
5
- import { EditorState, Plugin, Transaction } from "prosemirror-state";
5
+ import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
6
6
  //#region src/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts
7
7
  export declare const paragraphChangeTrackerKey: Readonly<{
8
8
  key: string;
9
- createKey: () => import("prosemirror-state").PluginKey<InternalParagraphChangeTrackerState>;
9
+ createKey: () => PluginKey<InternalParagraphChangeTrackerState>;
10
10
  owns: (plugin: Plugin<InternalParagraphChangeTrackerState>) => boolean;
11
11
  get: (state: EditorState) => Plugin<InternalParagraphChangeTrackerState> | undefined;
12
12
  getState: (state: EditorState) => InternalParagraphChangeTrackerState | undefined;
@@ -1,22 +1,5 @@
1
1
  import { Extension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/features/PasteCleanupExtension.d.ts
3
- /**
4
- * Paste Cleanup Extension
5
- *
6
- * Wires two paste-handling behaviors into the editor:
7
- *
8
- * 1. `transformPastedHTML` — strips Office/web producer cruft from pasted HTML
9
- * (see {@link cleanPastedHtml}) before the schema parser reads it. Runs at
10
- * `Highest` priority so the cleanup happens before the style inliner and the
11
- * default clipboard parser; ProseMirror chains every plugin's
12
- * `transformPastedHTML`, so this cooperates with the inliner rather than
13
- * replacing it, and `<style>` blocks are left intact for it to resolve.
14
- * 2. `transformPasted` — drops unpaired bookmark and move-range boundaries,
15
- * then points pasted headings at the open document's own heading style
16
- * (see {@link retargetPastedHeadingStyles}).
17
- * 3. `Mod-Alt-v` — "paste without formatting", inserting clipboard text with
18
- * the source formatting stripped (see {@link pasteWithoutFormatting}).
19
- */
20
3
  type PasteCleanupOptions = {
21
4
  getInternalClipboardToken?: () => string;
22
5
  };
@@ -1,19 +1,5 @@
1
1
  import { Extension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/features/PasteStyleInlinerExtension.d.ts
3
- /**
4
- * Paste Style Inliner Extension
5
- *
6
- * When pasting from apps like Google Docs that use class-based CSS
7
- * (e.g. `<style>.c5 { margin-top: 12pt }</style>`) instead of inline styles,
8
- * ProseMirror's parseDOM can't read the styles because elements aren't attached
9
- * to the live document during parsing.
10
- *
11
- * This extension provides a `transformPastedHTML` hook that:
12
- * 1. Parses the pasted HTML string
13
- * 2. Extracts all `<style>` rules
14
- * 3. Inlines them onto matching elements
15
- * 4. Returns the modified HTML so parseDOM can read inline styles
16
- */
17
3
  /**
18
4
  * Transform pasted HTML by inlining class-based CSS and unwrapping Google Docs wrappers.
19
5
  */
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/AllCapsExtension.d.ts
3
- /**
4
- * All Caps Mark Extension (w:caps)
5
- */
6
3
  export declare const AllCapsExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/BoldExtension.d.ts
3
- /**
4
- * Bold Mark Extension
5
- */
6
3
  export declare const BoldExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,12 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/CharacterSpacingExtension.d.ts
3
- /**
4
- * Character Spacing Mark Extension
5
- *
6
- * Handles: character spacing (w:spacing), position/raise-lower (w:position),
7
- * horizontal scale (w:w), and kerning (w:kern).
8
- *
9
- * Single mark with multiple attributes to avoid mark explosion.
10
- */
11
3
  export declare const CharacterSpacingExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
12
4
  //#endregion
@@ -1,18 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/CharacterStyleExtension.d.ts
3
- /**
4
- * Character Style Mark Extension (w:rStyle)
5
- *
6
- * Carries a run's character style reference through ProseMirror so semantic
7
- * styles (e.g. a house "DefinedTerm" style) survive the load → edit → save
8
- * round-trip. The style's resolved formatting is flattened into the regular
9
- * marks at load for rendering; this mark preserves only the reference. Style
10
- * formatting resolves through the document's shared style engine so it does
11
- * not become stale when a run moves between paragraph contexts.
12
- *
13
- * The mark renders as an unstyled span with a `data-character-style`
14
- * attribute. parseDOM restores the styleId (so copy/paste inside the editor
15
- * keeps the reference).
16
- */
17
3
  export declare const CharacterStyleExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
18
4
  //#endregion
@@ -1,10 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/CommentExtension.d.ts
3
- /**
4
- * Comment Mark Extension — highlights text that has comments
5
- *
6
- * Applied to text ranges between commentRangeStart and commentRangeEnd.
7
- * The comment ID links to the Comment object in the document model.
8
- */
9
3
  export declare const CommentExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
10
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/FontFamilyExtension.d.ts
3
- /**
4
- * Font Family Mark Extension
5
- */
6
3
  export declare const FontFamilyExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/FontSizeExtension.d.ts
3
- /**
4
- * Font Size Mark Extension
5
- */
6
3
  export declare const FontSizeExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,9 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/FootnoteRefExtension.d.ts
3
- /**
4
- * Footnote Reference Mark Extension
5
- *
6
- * Provides footnoteRef mark + insert/delete commands for footnotes and endnotes.
7
- */
8
3
  export declare const FootnoteRefExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
9
4
  //#endregion
@@ -1,21 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/HiddenTextExtension.d.ts
3
- /**
4
- * Hidden Text Mark Extension (w:vanish, OOXML §17.3.2.41)
5
- *
6
- * Word's editing view dims hidden text with a dotted underline so the
7
- * author can navigate to and edit it; the print/normal view suppresses it
8
- * entirely. The painter mirrors the editing-view treatment so PM cursor
9
- * traversal stays correct across hidden ranges. The `docx-hidden` class
10
- * hook lets host CSS opt into print-style suppression independently.
11
- *
12
- * The dotted-underline visual is delivered via `editor.css` (`.docx-hidden`
13
- * rule), NOT inline `text-decoration`. Inline `text-decoration: underline`
14
- * would be picked up by `UnderlineExtension`'s `style: "text-decoration"`
15
- * parser on DOM/clipboard reparse and add a spurious `<w:u>` alongside
16
- * `<w:vanish/>` on export.
17
- *
18
- * eigenpal #424 (w:vanish gap 9).
19
- */
20
3
  export declare const HiddenTextExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
21
4
  //#endregion
@@ -1,17 +1,5 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/InlineWrapperExtension.d.ts
3
- /**
4
- * Inline wrapper mark — the transparent wrappers a leaf sits inside.
5
- *
6
- * One mark for every wrapper kind rather than one mark per kind: ProseMirror's
7
- * mark set is unordered across types, so two marks could not say which wrapper
8
- * is inside which. The nesting lives in the `stack` attr, outermost first, and
9
- * the mark excludes itself (ProseMirror's default) because a second one would
10
- * be a second answer to the same question.
11
- *
12
- * `inclusive: false` so typing at the end of a wrapped span does not silently
13
- * extend the wrapper over text the author wrote outside it.
14
- */
15
3
  export declare const INLINE_WRAPPER_MARK_NAME = "inlineWrapper";
16
4
  export declare const InlineWrapperExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
17
5
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/ItalicExtension.d.ts
3
- /**
4
- * Italic Mark Extension
5
- */
6
3
  export declare const ItalicExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/SmallCapsExtension.d.ts
3
- /**
4
- * Small Caps Mark Extension (w:smallCaps)
5
- */
6
3
  export declare const SmallCapsExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/StrikeExtension.d.ts
3
- /**
4
- * Strikethrough Mark Extension
5
- */
6
3
  export declare const StrikeExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/SubscriptExtension.d.ts
3
- /**
4
- * Subscript Mark Extension
5
- */
6
3
  export declare const SubscriptExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/SuperscriptExtension.d.ts
3
- /**
4
- * Superscript Mark Extension
5
- */
6
3
  export declare const SuperscriptExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/TextColorExtension.d.ts
3
- /**
4
- * Text Color Mark Extension
5
- */
6
3
  export declare const TextColorExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -1,11 +1,5 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/TextEffectsExtensions.d.ts
3
- /**
4
- * Additional Text Effect Mark Extensions
5
- *
6
- * Emboss (w:emboss), Imprint/Engrave (w:imprint), Text Shadow (w:shadow),
7
- * Emphasis Marks (w:em), Text Outline (w:outline)
8
- */
9
3
  /**
10
4
  * Emboss — raised text effect via text-shadow
11
5
  */
@@ -1,12 +1,5 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts
3
- /**
4
- * Tracked Change Mark Extensions — insertion and deletion marks
5
- *
6
- * Renders insertions with colored underline and deletions with colored
7
- * strikethrough, matching the standard MS Word display for tracked changes.
8
- * Colors are assigned per author via CSS custom properties (see editor.css).
9
- */
10
3
  /**
11
4
  * Insertion mark — text added in tracked changes
12
5
  * Renders with per-author colored underline.
@@ -1,7 +1,4 @@
1
1
  import { MarkExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/marks/UnderlineExtension.d.ts
3
- /**
4
- * Underline Mark Extension
5
- */
6
3
  export declare const UnderlineExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
7
4
  //#endregion
@@ -2,6 +2,7 @@ import { document_d_exports } from "../../../types/document.js";
2
2
  import { CanonicalCommandIntent } from "../../canonicalCommands.js";
3
3
  import { Attrs, Mark, MarkType, Schema } from "prosemirror-model";
4
4
  import { Command, EditorState } from "prosemirror-state";
5
+ import { FormattingPatch } from "@stll/docx-core/ops";
5
6
  //#region src/prosemirror/extensions/marks/markUtils.d.ts
6
7
  type MarkAttrs = Record<string, unknown>;
7
8
  export declare const withRunFormattingLock: (command: Command, describe: (state: EditorState) => readonly CanonicalCommandIntent[] | undefined) => Command;
@@ -15,14 +16,14 @@ export declare const canonicalSetMarkFormatting: ({ state, type, attrs }: Canoni
15
16
  type: "formatRun";
16
17
  from: number;
17
18
  to: number;
18
- patch: import("@stll/docx-core/ops").FormattingPatch<{
19
+ patch: FormattingPatch<{
19
20
  bold?: boolean | undefined;
20
21
  boldCs?: boolean | undefined;
21
22
  italic?: boolean | undefined;
22
23
  italicCs?: boolean | undefined;
23
24
  underline?: {
24
25
  style: document_d_exports.UnderlineStyle;
25
- color?: import("@stll/docx-core/model").ColorValue;
26
+ color?: document_d_exports.ColorValue;
26
27
  } | undefined;
27
28
  strike?: boolean | undefined;
28
29
  doubleStrike?: boolean | undefined;
@@ -31,9 +32,9 @@ export declare const canonicalSetMarkFormatting: ({ state, type, attrs }: Canoni
31
32
  allCaps?: boolean | undefined;
32
33
  hidden?: boolean | undefined;
33
34
  noProof?: boolean | undefined;
34
- color?: import("@stll/docx-core/model").ColorValue | undefined;
35
+ color?: document_d_exports.ColorValue | undefined;
35
36
  highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow" | undefined;
36
- shading?: import("@stll/docx-core/model").ShadingProperties | undefined;
37
+ shading?: document_d_exports.ShadingProperties | undefined;
37
38
  fontSize?: number | undefined;
38
39
  fontSizeCs?: number | undefined;
39
40
  fontFamily?: {
@@ -56,8 +57,8 @@ export declare const canonicalSetMarkFormatting: ({ state, type, attrs }: Canoni
56
57
  position?: number | undefined;
57
58
  scale?: number | undefined;
58
59
  kerning?: number | undefined;
59
- effect?: import("@stll/docx-core/model").TextEffect | undefined;
60
- emphasisMark?: import("@stll/docx-core/model").EmphasisMark | undefined;
60
+ effect?: document_d_exports.TextEffect | undefined;
61
+ emphasisMark?: document_d_exports.EmphasisMark | undefined;
61
62
  emboss?: boolean | undefined;
62
63
  imprint?: boolean | undefined;
63
64
  outline?: boolean | undefined;
@@ -65,7 +66,7 @@ export declare const canonicalSetMarkFormatting: ({ state, type, attrs }: Canoni
65
66
  rtl?: boolean | undefined;
66
67
  cs?: boolean | undefined;
67
68
  styleId?: string | undefined;
68
- preserved?: import("@stll/docx-core/model").PreservedMarkup | undefined;
69
+ preserved?: document_d_exports.PreservedMarkup | undefined;
69
70
  }>;
70
71
  }[];
71
72
  export declare function setMark(type: MarkType, attrs: MarkAttrs): Command;
@@ -1,27 +1,5 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts
3
- /**
4
- * A bookmark boundary that stands between two blocks.
5
- *
6
- * The block-level twin of `bookmarkBoundary`. `CT_Body`, `CT_Tc` and
7
- * `CT_SdtContentBlock` declare `w:bookmarkStart`/`w:bookmarkEnd` beside their
8
- * paragraphs and tables, and Word writes them there whenever the selection was
9
- * whole blocks: `_GoBack` after an edit, a table-of-contents range around the
10
- * headings it lists. ProseMirror decides inline or block per node type, so the
11
- * inline atom cannot also sit here and this is its own node — with the same
12
- * attributes, read by the same reader, so the two levels cannot describe a
13
- * bookmark differently.
14
- *
15
- * **Position is structure, not an attribute**, for the reason
16
- * `PreservedBlockExtension` gives: the node sits between the same two blocks it
17
- * sat between in the source and ProseMirror's own mapping keeps it there, so an
18
- * edit inside the range cannot change what the range covers.
19
- *
20
- * Pairing is owned one level up. A bookmark may open at block level and close
21
- * inside a paragraph, which is the commoner shape in real documents, so the
22
- * integrity pass in `BookmarkBoundaryExtension` reads both node types together;
23
- * a rule enforced here would see half of each such pair and delete it.
24
- */
25
3
  type BlockBookmarkBoundaryOptions = {
26
4
  getInternalClipboardToken?: () => string;
27
5
  };
@@ -1,19 +1,5 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/BlockMoveRangeBoundaryExtension.d.ts
3
- /**
4
- * A tracked-move range boundary that stands between two blocks.
5
- *
6
- * The block-level twin of `moveRangeBoundary`, as `blockBookmarkBoundary` is
7
- * of `bookmarkBoundary`: `CT_Body`, `CT_Tc` and `CT_SdtContentBlock` declare
8
- * `w:moveFromRangeStart`/`End` and `w:moveToRangeStart`/`End` beside their
9
- * paragraphs and tables, and a move whose range opens or closes on whole
10
- * blocks is written there. The node carries the same marker, read by the same
11
- * reader, so the two levels cannot describe a move range differently.
12
- *
13
- * Position is structure, not an attribute: the node sits between the same two
14
- * blocks it sat between in the source, and ProseMirror's mapping keeps it
15
- * there.
16
- */
17
3
  type BlockMoveRangeBoundaryOptions = {
18
4
  getInternalClipboardToken?: () => string;
19
5
  };
@@ -1,21 +1,4 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/BlockSdtExtension.d.ts
3
- /**
4
- * BlockSdt Extension — block-level content control node.
5
- *
6
- * Mirrors OOXML's block `w:sdt` wrapping paragraphs/tables. `isolating: true`
7
- * keeps user edits scoped to the control (a backspace at the start of an
8
- * inner paragraph cannot merge through the boundary into a sibling), and
9
- * `defining: true` preserves the wrapper across split/lift.
10
- *
11
- * Attributes:
12
- * - `sdtType` / `alias` / `tag` / `lock` / `placeholder` /
13
- * `showingPlaceholder` / `dateFormat` / `listItems` / `checked` — modeled
14
- * projection of `w:sdtPr`; drives addressing and widget UX.
15
- * - `_preserved` — the `w:sdtPr` children folio does not model, at their
16
- * schema ordinal, so `w:dataBinding`, `w15:repeatingSection` and the
17
- * control-kind element round-trip without being enumerated here.
18
- * - `rawEndPropertiesXml` — the verbatim `<w:sdtEndPr>`.
19
- */
20
3
  export declare const BlockSdtExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
21
4
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/BookmarkBoundaryExtension.d.ts
3
- /** Zero-width bookmark boundary that preserves its position through ProseMirror edits. */
4
3
  type BookmarkBoundaryOptions = {
5
4
  getInternalClipboardToken?: () => string;
6
5
  };
@@ -1,13 +1,5 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/FieldExtension.d.ts
3
- /**
4
- * Field extensions — atomic inline fields (PAGE, NUMPAGES, REF, etc.).
5
- *
6
- * Ordinary fields are true ProseMirror leaves, so `textContent`, `textBetween`,
7
- * and the default plain-text clipboard serializer can use `leafText`.
8
- * Fields that preserve run metadata or inline structure use a distinct atomic
9
- * node with inline children; their visible text comes from those children.
10
- */
11
3
  type FieldOptions = {
12
4
  getInternalClipboardToken?: () => string;
13
5
  };
@@ -1,7 +1,4 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/HardBreakExtension.d.ts
3
- /**
4
- * Hard Break Extension — Shift+Enter line break
5
- */
6
3
  export declare const HardBreakExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/HorizontalRuleExtension.d.ts
3
- /**
4
- * Horizontal Rule Extension
5
- */
6
3
  export declare const HorizontalRuleExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
7
4
  //#endregion
@@ -1,7 +1,4 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/ImageExtension.d.ts
3
- /**
4
- * Image Extension — inline/floating image node
5
- */
6
3
  export declare const ImageExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
7
4
  //#endregion
@@ -1,11 +1,4 @@
1
1
  import { NodeExtension } from "../types.js";
2
2
  //#region src/prosemirror/extensions/nodes/MathExtension.d.ts
3
- /**
4
- * Math Extension — inline/block math equation node (OMML)
5
- *
6
- * Represents Office Math Markup Language equations as atomic nodes.
7
- * Stores the raw OMML XML for round-trip fidelity and shows a plain
8
- * text fallback in the editor.
9
- */
10
3
  export declare const MathExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
11
4
  //#endregion