@superdoc-dev/cli 0.17.0-next.44 → 0.17.0-next.45

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 (2) hide show
  1. package/dist/index.js +570 -69
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -2899,13 +2899,13 @@ More content with **bold** and *italic*.`
2899
2899
  },
2900
2900
  "lists.attach": {
2901
2901
  memberPath: "lists.attach",
2902
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
2902
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
2903
2903
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
2904
2904
  requiresDocumentContext: true,
2905
2905
  metadata: mutationOperation({
2906
2906
  idempotency: "conditional",
2907
2907
  supportsDryRun: true,
2908
- supportsTrackedMode: false,
2908
+ supportsTrackedMode: true,
2909
2909
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
2910
2910
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2911
2911
  }),
@@ -11013,6 +11013,27 @@ var init_schemas = __esm(() => {
11013
11013
  },
11014
11014
  additionalProperties: false
11015
11015
  },
11016
+ numbering: {
11017
+ type: "object",
11018
+ description: 'Computed numbering rendering (marker/path/kind) for numbered list items and numbered headings — e.g. the rendered clause label "2.3.". Absent for non-numbered blocks.',
11019
+ properties: {
11020
+ marker: { oneOf: [{ type: "string" }, { type: "null" }] },
11021
+ path: { oneOf: [{ type: "array", items: { type: "number" } }, { type: "null" }] },
11022
+ kind: { oneOf: [{ type: "string" }, { type: "null" }] }
11023
+ },
11024
+ additionalProperties: false
11025
+ },
11026
+ indent: {
11027
+ type: "object",
11028
+ description: "Direct paragraph indentation in twips (only non-zero fields present).",
11029
+ properties: {
11030
+ left: { type: "number" },
11031
+ right: { type: "number" },
11032
+ firstLine: { type: "number" },
11033
+ hanging: { type: "number" }
11034
+ },
11035
+ additionalProperties: false
11036
+ },
11016
11037
  ref: {
11017
11038
  type: "string",
11018
11039
  description: "Ref handle for this block. Pass directly to superdoc_format or superdoc_edit ref param. Only present for non-empty blocks."
@@ -12524,6 +12545,10 @@ var init_schemas = __esm(() => {
12524
12545
  moveRole: {
12525
12546
  enum: ["pair", "source", "destination"],
12526
12547
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
12548
+ },
12549
+ side: {
12550
+ enum: ["inserted", "deleted"],
12551
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half, leaving the other half as a standalone pending change."
12527
12552
  }
12528
12553
  }, ["kind", "id"]),
12529
12554
  objectSchema({
@@ -12560,6 +12585,10 @@ var init_schemas = __esm(() => {
12560
12585
  moveRole: {
12561
12586
  enum: ["pair", "source", "destination"],
12562
12587
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
12588
+ },
12589
+ side: {
12590
+ enum: ["inserted", "deleted"],
12591
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
12563
12592
  }
12564
12593
  }, ["id"]),
12565
12594
  objectSchema({
@@ -17601,10 +17630,11 @@ function executeTrackChangesDecide(adapter, rawInput, options) {
17601
17630
  return adapter.rejectAll(input, revisionOptions);
17602
17631
  }
17603
17632
  const { id, story } = canonical.target;
17633
+ const side = canonical.target.side;
17604
17634
  if (canonical.decision === "accept") {
17605
- return adapter.accept({ id, ...story ? { story } : {} }, revisionOptions);
17635
+ return adapter.accept({ id, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
17606
17636
  }
17607
- return adapter.reject({ id, ...story ? { story } : {} }, revisionOptions);
17637
+ return adapter.reject({ id, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
17608
17638
  }
17609
17639
  function isValidLegacyPartialIdRangeTarget(input) {
17610
17640
  if (typeof input !== "object" || input == null)
@@ -17650,11 +17680,13 @@ function normalizeReviewDecideTarget(target) {
17650
17680
  }
17651
17681
  const story = readOptionalStory(target, "target.story", false);
17652
17682
  const moveRole = readOptionalMoveRole(target);
17683
+ const side = readOptionalReplacementSide(target);
17653
17684
  return {
17654
17685
  kind: "id",
17655
17686
  id,
17656
17687
  ...story ? { story } : {},
17657
- ...moveRole ? { moveRole } : {}
17688
+ ...moveRole ? { moveRole } : {},
17689
+ ...side ? { side } : {}
17658
17690
  };
17659
17691
  }
17660
17692
  if (kind === "range") {
@@ -17729,11 +17761,13 @@ function normalizeReviewDecideTarget(target) {
17729
17761
  if (typeof target.id === "string" && target.id.length > 0) {
17730
17762
  const story = readOptionalStory(target, "target.story", false);
17731
17763
  const moveRole = readOptionalMoveRole(target);
17764
+ const side = readOptionalReplacementSide(target);
17732
17765
  return {
17733
17766
  kind: "id",
17734
17767
  id: target.id,
17735
17768
  ...story ? { story } : {},
17736
- ...moveRole ? { moveRole } : {}
17769
+ ...moveRole ? { moveRole } : {},
17770
+ ...side ? { side } : {}
17737
17771
  };
17738
17772
  }
17739
17773
  }
@@ -17850,6 +17884,18 @@ function readOptionalMoveRole(target) {
17850
17884
  }
17851
17885
  return moveRole;
17852
17886
  }
17887
+ function readOptionalReplacementSide(target) {
17888
+ if (!("side" in target))
17889
+ return;
17890
+ const side = target.side;
17891
+ if (side === undefined || side === null)
17892
+ return;
17893
+ if (side === "inserted")
17894
+ return "inserted";
17895
+ if (side === "deleted")
17896
+ return "deleted";
17897
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', { field: "target.side", value: side });
17898
+ }
17853
17899
  function validateRangeTargetSide(side) {
17854
17900
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination") {
17855
17901
  return;
@@ -68164,7 +68210,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
68164
68210
  emptyOptions2 = {};
68165
68211
  });
68166
68212
 
68167
- // ../../packages/superdoc/dist/chunks/SuperConverter-Ed3nFN54.es.js
68213
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DlrS7cQT.es.js
68168
68214
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68169
68215
  const fieldValue = extension$1.config[field];
68170
68216
  if (typeof fieldValue === "function")
@@ -71946,14 +71992,17 @@ function executeTrackChangesDecide2(adapter, rawInput, options) {
71946
71992
  return adapter.rejectAll(input, revisionOptions);
71947
71993
  }
71948
71994
  const { id: id2, story } = canonical.target;
71995
+ const side = canonical.target.side;
71949
71996
  if (canonical.decision === "accept")
71950
71997
  return adapter.accept({
71951
71998
  id: id2,
71952
- ...story ? { story } : {}
71999
+ ...story ? { story } : {},
72000
+ ...side ? { side } : {}
71953
72001
  }, revisionOptions);
71954
72002
  return adapter.reject({
71955
72003
  id: id2,
71956
- ...story ? { story } : {}
72004
+ ...story ? { story } : {},
72005
+ ...side ? { side } : {}
71957
72006
  }, revisionOptions);
71958
72007
  }
71959
72008
  function isValidLegacyPartialIdRangeTarget2(input) {
@@ -72004,11 +72053,13 @@ function normalizeReviewDecideTarget2(target) {
72004
72053
  });
72005
72054
  const story = readOptionalStory2(target, "target.story", false);
72006
72055
  const moveRole = readOptionalMoveRole2(target);
72056
+ const side = readOptionalReplacementSide2(target);
72007
72057
  return {
72008
72058
  kind: "id",
72009
72059
  id: id2,
72010
72060
  ...story ? { story } : {},
72011
- ...moveRole ? { moveRole } : {}
72061
+ ...moveRole ? { moveRole } : {},
72062
+ ...side ? { side } : {}
72012
72063
  };
72013
72064
  }
72014
72065
  if (kind === "range") {
@@ -72099,11 +72150,13 @@ function normalizeReviewDecideTarget2(target) {
72099
72150
  if (typeof target.id === "string" && target.id.length > 0) {
72100
72151
  const story = readOptionalStory2(target, "target.story", false);
72101
72152
  const moveRole = readOptionalMoveRole2(target);
72153
+ const side = readOptionalReplacementSide2(target);
72102
72154
  return {
72103
72155
  kind: "id",
72104
72156
  id: target.id,
72105
72157
  ...story ? { story } : {},
72106
- ...moveRole ? { moveRole } : {}
72158
+ ...moveRole ? { moveRole } : {},
72159
+ ...side ? { side } : {}
72107
72160
  };
72108
72161
  }
72109
72162
  }
@@ -72259,6 +72312,21 @@ function readOptionalMoveRole2(target) {
72259
72312
  });
72260
72313
  return moveRole;
72261
72314
  }
72315
+ function readOptionalReplacementSide2(target) {
72316
+ if (!("side" in target))
72317
+ return;
72318
+ const side = target.side;
72319
+ if (side === undefined || side === null)
72320
+ return;
72321
+ if (side === "inserted")
72322
+ return "inserted";
72323
+ if (side === "deleted")
72324
+ return "deleted";
72325
+ throw new DocumentApiValidationError2("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', {
72326
+ field: "target.side",
72327
+ value: side
72328
+ });
72329
+ }
72262
72330
  function validateRangeTargetSide2(side) {
72263
72331
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination")
72264
72332
  return;
@@ -80436,6 +80504,31 @@ function hasValidDrawingContent(drawingContent) {
80436
80504
  return false;
80437
80505
  return drawingChildren.some((child) => child && typeof child === "object" && (child.name === "wp:inline" || child.name === "wp:anchor"));
80438
80506
  }
80507
+ function resolvePprChangeWordId(params3, change) {
80508
+ const idStr = String(change?.id ?? "");
80509
+ const allocator = params3?.converter?.wordIdAllocator;
80510
+ if (allocator) {
80511
+ const partPath = params3?.currentPartPath || "word/document.xml";
80512
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
80513
+ return String(allocator.allocate({
80514
+ partPath,
80515
+ sourceId,
80516
+ logicalId: idStr
80517
+ }));
80518
+ }
80519
+ return toDecimalWordId(change?.id);
80520
+ }
80521
+ function toDecimalWordId(id2) {
80522
+ const str = String(id2);
80523
+ if (/^\d+$/.test(str))
80524
+ return str;
80525
+ let hash = 2166136261;
80526
+ for (let i$1 = 0;i$1 < str.length; i$1++) {
80527
+ hash ^= str.charCodeAt(i$1);
80528
+ hash = Math.imul(hash, 16777619);
80529
+ }
80530
+ return String(1e6 + (hash >>> 0) % 1e9);
80531
+ }
80439
80532
  function getSectPr(pPrNode) {
80440
80533
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
80441
80534
  return sectPr ? carbonCopy(sectPr) : undefined;
@@ -80605,6 +80698,8 @@ function generateParagraphProperties(params3) {
80605
80698
  const { node: node3 } = params3;
80606
80699
  const { attrs = {} } = node3;
80607
80700
  const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
80701
+ if (params3?.isFinalDoc && paragraphProperties.change)
80702
+ delete paragraphProperties.change;
80608
80703
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
80609
80704
  delete paragraphProperties.runPropertiesInlineKeys;
80610
80705
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0)
@@ -80621,10 +80716,14 @@ function generateParagraphProperties(params3) {
80621
80716
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
80622
80717
  partPath: resolveExportPartPath$1(params3)
80623
80718
  } : null;
80624
- let pPr = translator$129.decode({ node: {
80625
- ...node3,
80626
- attrs: { paragraphProperties }
80627
- } });
80719
+ let pPr = translator$129.decode({
80720
+ node: {
80721
+ ...node3,
80722
+ attrs: { paragraphProperties }
80723
+ },
80724
+ converter: params3?.converter,
80725
+ currentPartPath: resolveExportPartPath$1(params3)
80726
+ });
80628
80727
  if (!params3?.isFinalDoc && paragraphSplitTrackFormatMark) {
80629
80728
  const insertionElement = createParagraphSplitInsertionElement(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
80630
80729
  if (insertionElement)
@@ -91331,11 +91430,24 @@ function getDefinitionForLevel(data, level) {
91331
91430
  return cachedLevels.get(parsedLevel);
91332
91431
  return data?.elements?.find((item) => Number(item.attributes?.["w:ilvl"]) === parsedLevel);
91333
91432
  }
91334
- function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr) {
91433
+ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
91434
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
91335
91435
  const newProperties = {
91336
- ...paragraphNode.attrs.paragraphProperties || {},
91436
+ ...formerProperties,
91337
91437
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
91338
91438
  };
91439
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
91440
+ const former = { ...formerProperties };
91441
+ delete former.change;
91442
+ const user = editor?.options?.user || {};
91443
+ newProperties.change = {
91444
+ id: v4_default(),
91445
+ author: user.name || "",
91446
+ authorEmail: user.email || "",
91447
+ date: (/* @__PURE__ */ new Date()).toISOString(),
91448
+ paragraphProperties: former
91449
+ };
91450
+ }
91339
91451
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph")
91340
91452
  newProperties.styleId = null;
91341
91453
  if (newProperties.indent)
@@ -113364,6 +113476,28 @@ function groupTrackedChanges(editor) {
113364
113476
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
113365
113477
  });
113366
113478
  }
113479
+ const pprChanges = enumeratePprChanges(editor.state);
113480
+ for (const ppr of pprChanges) {
113481
+ const excerpt = normalizeExcerpt(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
113482
+ grouped.push({
113483
+ rawId: ppr.id,
113484
+ commandRawId: ppr.id,
113485
+ id: ppr.id,
113486
+ from: ppr.from,
113487
+ to: ppr.to,
113488
+ hasInsert: false,
113489
+ hasDelete: false,
113490
+ hasFormat: true,
113491
+ attrs: {
113492
+ id: ppr.id,
113493
+ author: ppr.author || undefined,
113494
+ authorEmail: ppr.authorEmail || undefined,
113495
+ authorImage: ppr.authorImage || undefined,
113496
+ date: ppr.date || undefined
113497
+ },
113498
+ excerpt
113499
+ });
113500
+ }
113367
113501
  grouped.sort((a, b) => {
113368
113502
  if (a.from !== b.from)
113369
113503
  return a.from - b.from;
@@ -113836,7 +113970,7 @@ function applyPagination(items, opts) {
113836
113970
  };
113837
113971
  }
113838
113972
  function resolveBlock(editor, nodeId) {
113839
- const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
113973
+ const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading"));
113840
113974
  if (matches$1.length === 0)
113841
113975
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
113842
113976
  if (matches$1.length > 1)
@@ -113854,7 +113988,7 @@ function resolveBlocksInRange(editor, fromId, toId$1) {
113854
113988
  from: fromId,
113855
113989
  to: toId$1
113856
113990
  });
113857
- return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem") && c$1.pos >= from5.pos && c$1.pos <= to.pos);
113991
+ return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading") && c$1.pos >= from5.pos && c$1.pos <= to.pos);
113858
113992
  }
113859
113993
  function getAbstractNumId(editor, numId) {
113860
113994
  const definitions = editor.converter?.numbering?.definitions;
@@ -114089,7 +114223,15 @@ function getListText(candidate) {
114089
114223
  }
114090
114224
  function projectListItemCandidate(editor, candidate) {
114091
114225
  const attrs = candidate.node.attrs ?? {};
114092
- const { numId, level } = getNumberingProperties(candidate.node);
114226
+ let { numId, level } = getNumberingProperties(candidate.node);
114227
+ if (numId == null)
114228
+ try {
114229
+ const effective = calculateResolvedParagraphProperties(editor, candidate.node, editor.state.doc.resolve(candidate.pos))?.numberingProperties;
114230
+ if (effective) {
114231
+ numId = toFiniteNumber(effective.numId);
114232
+ level = toFiniteNumber(effective.ilvl) ?? level ?? 0;
114233
+ }
114234
+ } catch {}
114093
114235
  const listRendering = getListRendering(attrs.listRendering);
114094
114236
  const path2 = listRendering?.path;
114095
114237
  const ordinal = getListOrdinalFromPath(path2);
@@ -114201,8 +114343,17 @@ function listListItems(editor, query2) {
114201
114343
  }
114202
114344
  });
114203
114345
  }
114346
+ function hasNumberingMetadata(candidate) {
114347
+ const { numId } = getNumberingProperties(candidate.node);
114348
+ if (numId != null)
114349
+ return true;
114350
+ return getListRendering((candidate.node.attrs ?? {}).listRendering) != null;
114351
+ }
114204
114352
  function resolveListItem(editor, address2) {
114205
- const matches$1 = getBlockIndex(editor).candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
114353
+ const index2 = getBlockIndex(editor);
114354
+ let matches$1 = index2.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
114355
+ if (matches$1.length === 0)
114356
+ matches$1 = index2.candidates.filter((candidate) => candidate.nodeId === address2.nodeId && hasNumberingMetadata(candidate));
114206
114357
  if (matches$1.length === 0)
114207
114358
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "List item target was not found.", { target: address2 });
114208
114359
  if (matches$1.length > 1)
@@ -136603,7 +136754,34 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136603
136754
  "data-track-change-date": change.date || ""
136604
136755
  }));
136605
136756
  }
136606
- }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
136757
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, enumeratePprChanges = (state) => {
136758
+ const doc$2 = state?.doc;
136759
+ if (!doc$2)
136760
+ return [];
136761
+ const out = [];
136762
+ try {
136763
+ doc$2.descendants((node3, pos) => {
136764
+ if (node3.isText)
136765
+ return false;
136766
+ const change = node3?.attrs?.paragraphProperties?.change;
136767
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties)
136768
+ out.push({
136769
+ id: change.id,
136770
+ from: pos,
136771
+ to: pos + node3.nodeSize,
136772
+ author: change.author || "",
136773
+ authorEmail: change.authorEmail || "",
136774
+ authorImage: change.authorImage || "",
136775
+ date: change.date || "",
136776
+ formerProperties: change.paragraphProperties || {},
136777
+ subtype: "paragraph-format"
136778
+ });
136779
+ });
136780
+ } catch {
136781
+ return out;
136782
+ }
136783
+ return out;
136784
+ }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
136607
136785
  if (!runProps?.elements?.length || !state)
136608
136786
  return;
136609
136787
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -136637,7 +136815,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
136637
136815
  state.kern = kernNode.attributes["w:val"];
136638
136816
  }
136639
136817
  }, SuperConverter;
136640
- var init_SuperConverter_Ed3nFN54_es = __esm(() => {
136818
+ var init_SuperConverter_DlrS7cQT_es = __esm(() => {
136641
136819
  init_rolldown_runtime_Bg48TavK_es();
136642
136820
  init_jszip_C49i9kUs_es();
136643
136821
  init_xml_js_CqGKpaft_es();
@@ -141515,6 +141693,8 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
141515
141693
  ...params3.node,
141516
141694
  attrs: change
141517
141695
  } });
141696
+ if (decodedAttrs["w:id"] != null)
141697
+ decodedAttrs["w:id"] = resolvePprChangeWordId(params3, change);
141518
141698
  const hasParagraphProperties$1 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
141519
141699
  const paragraphProperties = hasParagraphProperties$1 ? change.paragraphProperties : undefined;
141520
141700
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator.decode({
@@ -165253,7 +165433,15 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
165253
165433
  }
165254
165434
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
165255
165435
  this.exportWarnings = [];
165256
- const exportableComments = comments.filter((c$1) => !c$1.trackedChange);
165436
+ const isSyntheticTrackedChangeRow = (c$1) => {
165437
+ const linkId = c$1.trackedChangeLink?.trackedChangeId;
165438
+ if (!c$1.trackedChange || !linkId)
165439
+ return false;
165440
+ const identity = c$1.commentId ?? c$1.id;
165441
+ return identity != null && String(identity) === String(linkId);
165442
+ };
165443
+ const hasCommentBody = (c$1) => Boolean(typeof c$1.commentText === "string" && c$1.commentText.length > 0 || c$1.commentJSON || Array.isArray(c$1.elements) && c$1.elements.length || typeof c$1.text === "string" && c$1.text.length > 0);
165444
+ const exportableComments = comments.filter((c$1) => !isSyntheticTrackedChangeRow(c$1) && !(c$1.trackedChange && !hasCommentBody(c$1)));
165257
165445
  const commentsWithParaIds = exportableComments.map((c$1) => prepareCommentParaIds(c$1));
165258
165446
  const commentDefinitions = commentsWithParaIds.map((c$1, index2) => getCommentDefinition(c$1, index2, commentsWithParaIds, editor));
165259
165447
  let statFieldCacheMap;
@@ -165643,7 +165831,7 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
165643
165831
  };
165644
165832
  });
165645
165833
 
165646
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-PSeH6IV5.es.js
165834
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bm-c7KZd.es.js
165647
165835
  function parseSizeUnit(val = "0") {
165648
165836
  const length3 = val.toString() || "0";
165649
165837
  const value = Number.parseFloat(length3);
@@ -170076,7 +170264,25 @@ function executeTextDelete(_editor, tr, target, _step, mapping) {
170076
170264
  tr.delete(absFrom, absTo);
170077
170265
  return { changed: true };
170078
170266
  }
170079
- function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
170267
+ function withTrackedParagraphPropertyChange(editor, existing, nextParagraphProperties, changeMode) {
170268
+ if (changeMode !== "tracked")
170269
+ return nextParagraphProperties;
170270
+ if (existing?.change)
170271
+ return nextParagraphProperties;
170272
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
170273
+ const user = editor?.options?.user ?? {};
170274
+ return {
170275
+ ...nextParagraphProperties,
170276
+ change: {
170277
+ id: v4_default(),
170278
+ author: user.name || "",
170279
+ authorEmail: user.email || "",
170280
+ date: (/* @__PURE__ */ new Date()).toISOString(),
170281
+ paragraphProperties: formerProperties
170282
+ }
170283
+ };
170284
+ }
170285
+ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment, changeMode) {
170080
170286
  if (!alignment)
170081
170287
  return false;
170082
170288
  let changed = false;
@@ -170087,10 +170293,10 @@ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
170087
170293
  const justification = mapAlignmentToJustificationForParagraph(alignment, calculateResolvedParagraphProperties(editor, node3, typeof tr.doc.resolve === "function" ? tr.doc.resolve(pos) : null)?.rightToLeft === true);
170088
170294
  if (existing?.justification === justification)
170089
170295
  return;
170090
- const updated = {
170296
+ const updated = withTrackedParagraphPropertyChange(editor, existing, {
170091
170297
  ...existing ?? {},
170092
170298
  justification
170093
- };
170299
+ }, changeMode);
170094
170300
  tr.setNodeMarkup(pos, undefined, {
170095
170301
  ...node3.attrs,
170096
170302
  paragraphProperties: updated
@@ -170115,7 +170321,7 @@ function expandToBlockBoundaries$1(doc2, from5, to) {
170115
170321
  to: expandedTo
170116
170322
  };
170117
170323
  }
170118
- function executeStyleApply3(editor, tr, target, step$1, mapping) {
170324
+ function executeStyleApply3(editor, tr, target, step$1, mapping, changeMode) {
170119
170325
  let absFrom = mapping.map(target.absFrom);
170120
170326
  let absTo = mapping.map(target.absTo);
170121
170327
  if (step$1.args.scope === "block") {
@@ -170127,7 +170333,7 @@ function executeStyleApply3(editor, tr, target, step$1, mapping) {
170127
170333
  if (step$1.args.inline)
170128
170334
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
170129
170335
  if (step$1.args.alignment)
170130
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
170336
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
170131
170337
  return { changed };
170132
170338
  }
170133
170339
  function validateMappedSpanContiguity(target, mapping, stepId) {
@@ -170198,7 +170404,7 @@ function executeSpanTextDelete(_editor, tr, target, step$1, mapping) {
170198
170404
  tr.delete(absFrom, absTo);
170199
170405
  return { changed: true };
170200
170406
  }
170201
- function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
170407
+ function executeSpanStyleApply(editor, tr, target, step$1, mapping, changeMode) {
170202
170408
  validateMappedSpanContiguity(target, mapping, step$1.id);
170203
170409
  const firstSeg = target.segments[0];
170204
170410
  const lastSeg = target.segments[target.segments.length - 1];
@@ -170213,7 +170419,7 @@ function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
170213
170419
  if (step$1.args.inline)
170214
170420
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
170215
170421
  if (step$1.args.alignment)
170216
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
170422
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
170217
170423
  return { changed };
170218
170424
  }
170219
170425
  function getReplacementText(replacement) {
@@ -176446,9 +176652,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN2, P
176446
176652
  }
176447
176653
  };
176448
176654
  };
176449
- var init_create_headless_toolbar_PSeH6IV5_es = __esm(() => {
176655
+ var init_create_headless_toolbar_Bm_c7KZd_es = __esm(() => {
176450
176656
  init_rolldown_runtime_Bg48TavK_es();
176451
- init_SuperConverter_Ed3nFN54_es();
176657
+ init_SuperConverter_DlrS7cQT_es();
176452
176658
  init_jszip_C49i9kUs_es();
176453
176659
  init_uuid_B2wVPhPi_es();
176454
176660
  init_constants_D9qj59G2_es();
@@ -226541,7 +226747,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226541
226747
  init_remark_gfm_BUJjZJLy_es();
226542
226748
  });
226543
226749
 
226544
- // ../../packages/superdoc/dist/chunks/src-bMRzO9Kl.es.js
226750
+ // ../../packages/superdoc/dist/chunks/src-CVmBLxZV.es.js
226545
226751
  function deleteProps(obj, propOrProps) {
226546
226752
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226547
226753
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -244573,7 +244779,7 @@ function trackChangesGetWrapper(editor, input2) {
244573
244779
  imported: Boolean(toNonEmptyString(resolved.change.attrs.sourceId))
244574
244780
  };
244575
244781
  }
244576
- function decideSingle(hostEditor, decision, id2, story, options) {
244782
+ function decideSingle(hostEditor, decision, id2, story, options, side) {
244577
244783
  const resolved = resolveTrackedChangeInStory(hostEditor, {
244578
244784
  kind: "entity",
244579
244785
  entityType: "trackedChange",
@@ -244591,7 +244797,7 @@ function decideSingle(hostEditor, decision, id2, story, options) {
244591
244797
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${decision === "accept" ? "Accept" : "Reject"} tracked change command is not available on the story editor.`, { reason: "missing_command" });
244592
244798
  checkRevision(hostEditor, options?.expectedRevision);
244593
244799
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
244594
- if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId))).steps[0]?.effect !== "changed")
244800
+ if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId, side ? { side } : undefined))).steps[0]?.effect !== "changed")
244595
244801
  return decisionFailureReceipt(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
244596
244802
  id: id2,
244597
244803
  story
@@ -244603,10 +244809,10 @@ function decideSingle(hostEditor, decision, id2, story, options) {
244603
244809
  return { success: true };
244604
244810
  }
244605
244811
  function trackChangesAcceptWrapper(editor, input2, options) {
244606
- return decideSingle(editor, "accept", input2.id, input2.story, options);
244812
+ return decideSingle(editor, "accept", input2.id, input2.story, options, input2.side);
244607
244813
  }
244608
244814
  function trackChangesRejectWrapper(editor, input2, options) {
244609
- return decideSingle(editor, "reject", input2.id, input2.story, options);
244815
+ return decideSingle(editor, "reject", input2.id, input2.story, options, input2.side);
244610
244816
  }
244611
244817
  function decideAll(editor, decision, input2, options) {
244612
244818
  const index2 = getTrackedChangeIndex(editor);
@@ -245672,6 +245878,7 @@ function replyToCommentHandler(editor, input2, options) {
245672
245878
  };
245673
245879
  if (trackedPayload && inheritedTrackedFields)
245674
245880
  emitCommentLifecycleUpdate(editor, "update", trackedPayload);
245881
+ incrementRevision(editor);
245675
245882
  return {
245676
245883
  success: true,
245677
245884
  id: replyId,
@@ -248367,6 +248574,13 @@ function extractBlockNumbering(node3) {
248367
248574
  function extractBlockFormatting(node3, styleCtx) {
248368
248575
  const pProps = node3.attrs.paragraphProperties;
248369
248576
  const styleId$1 = pProps?.styleId ?? null;
248577
+ const rawIndent = pProps?.indent;
248578
+ const indent2 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries([
248579
+ "left",
248580
+ "right",
248581
+ "firstLine",
248582
+ "hanging"
248583
+ ].filter((k$1) => typeof rawIndent[k$1] === "number" && rawIndent[k$1] !== 0).map((k$1) => [k$1, rawIndent[k$1]])) : undefined;
248370
248584
  let fontFamily;
248371
248585
  let fontSize;
248372
248586
  let bold2;
@@ -248415,6 +248629,7 @@ function extractBlockFormatting(node3, styleCtx) {
248415
248629
  ...underline ? { underline } : {},
248416
248630
  ...color2 ? { color: color2 } : {},
248417
248631
  ...pProps?.justification ? { alignment: pProps.justification } : {},
248632
+ ...indent2 && Object.keys(indent2).length > 0 ? { indent: indent2 } : {},
248418
248633
  ...headingLevel ? { headingLevel } : {}
248419
248634
  };
248420
248635
  }
@@ -248502,6 +248717,7 @@ function blocksListWrapper(editor, input2) {
248502
248717
  }],
248503
248718
  blockIndex: offset$1 + i3
248504
248719
  }) : undefined;
248720
+ const listRendering = candidate.node.attrs?.listRendering;
248505
248721
  return {
248506
248722
  ordinal: offset$1 + i3,
248507
248723
  nodeId: candidate.nodeId,
@@ -248510,6 +248726,11 @@ function blocksListWrapper(editor, input2) {
248510
248726
  ...fullText !== undefined ? { text: fullText } : {},
248511
248727
  isEmpty: textLength === 0,
248512
248728
  ...extractBlockFormatting(candidate.node, styleCtx),
248729
+ ...listRendering ? { numbering: {
248730
+ marker: listRendering.markerText ?? null,
248731
+ path: listRendering.path ?? null,
248732
+ kind: listRendering.numberingType ?? null
248733
+ } } : {},
248513
248734
  ...numbering ? { paragraphNumbering: numbering } : {},
248514
248735
  ...ref$1 ? { ref: ref$1 } : {}
248515
248736
  };
@@ -249842,7 +250063,9 @@ function listsCreateWrapper(editor, input2, options) {
249842
250063
  };
249843
250064
  }
249844
250065
  function listsAttachWrapper(editor, input2, options) {
249845
- rejectTrackedMode("lists.attach", options);
250066
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
250067
+ if (trackChange)
250068
+ ensureTrackedCapability(editor, { operation: "lists.attach" });
249846
250069
  const attachTo = resolveListItem(editor, input2.attachTo);
249847
250070
  if (attachTo.numId == null)
249848
250071
  return toListsFailure$1("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", { attachTo: input2.attachTo });
@@ -249869,7 +250092,7 @@ function listsAttachWrapper(editor, input2, options) {
249869
250092
  updateNumberingProperties({
249870
250093
  numId,
249871
250094
  ilvl: level
249872
- }, block.node, block.pos, editor, tr);
250095
+ }, block.node, block.pos, editor, tr, { trackChange });
249873
250096
  dispatchEditorTransaction$1(editor, tr);
249874
250097
  clearIndexCache(editor);
249875
250098
  return true;
@@ -254212,11 +254435,17 @@ function tablesSetShadingAdapter(editor, input2, options) {
254212
254435
  color: "auto"
254213
254436
  };
254214
254437
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
254215
- tr.setNodeMarkup(resolved.pos, null, {
254438
+ const nextAttrs = {
254216
254439
  ...currentAttrs,
254217
254440
  [propsKey]: currentProps,
254218
254441
  ...syncAttrs
254219
- });
254442
+ };
254443
+ if (resolved.scope === "cell")
254444
+ if (normalizedColor === "auto")
254445
+ delete nextAttrs.background;
254446
+ else
254447
+ nextAttrs.background = { color: normalizedColor };
254448
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
254220
254449
  if (resolved.scope === "table")
254221
254450
  applyShadingToCells(tr, resolved.node, resolved.pos + 1, normalizedColor);
254222
254451
  applyDirectMutationMeta(tr);
@@ -254243,11 +254472,14 @@ function tablesClearShadingAdapter(editor, input2, options) {
254243
254472
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
254244
254473
  delete currentProps.shading;
254245
254474
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
254246
- tr.setNodeMarkup(resolved.pos, null, {
254475
+ const nextAttrs = {
254247
254476
  ...currentAttrs,
254248
254477
  [propsKey]: currentProps,
254249
254478
  ...syncAttrs
254250
- });
254479
+ };
254480
+ if (resolved.scope === "cell")
254481
+ delete nextAttrs.background;
254482
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
254251
254483
  if (resolved.scope === "table") {
254252
254484
  const tableNode = resolved.node;
254253
254485
  const tableStart = resolved.pos + 1;
@@ -255290,7 +255522,7 @@ function registerBuiltInExecutors() {
255290
255522
  registerStepExecutor("text.delete", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeTextDelete(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanTextDelete(e, tr, t, s2, m$1)) });
255291
255523
  registerStepExecutor("format.apply", { execute: (ctx$1, targets, step3) => {
255292
255524
  ensureFormatStepCapabilities(ctx$1, step3);
255293
- return executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1));
255525
+ return executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1, ctx$1.changeMode), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1, ctx$1.changeMode));
255294
255526
  } });
255295
255527
  registerStepExecutor("create.paragraph", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
255296
255528
  registerStepExecutor("create.heading", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
@@ -296991,11 +297223,12 @@ var Node$13 = class Node$14 {
296991
297223
  return buildGraphFromSpans({
296992
297224
  spans: enumerateTrackedMarkSpans(state),
296993
297225
  structuralChanges: enumerateStructuralRowChanges(state),
297226
+ pprChanges: enumeratePprChanges(state),
296994
297227
  doc: state?.doc ?? null,
296995
297228
  story,
296996
297229
  replacementsMode
296997
297230
  });
296998
- }, buildGraphFromSpans = ({ spans, structuralChanges = [], doc: doc$12, story, replacementsMode }) => {
297231
+ }, buildGraphFromSpans = ({ spans, structuralChanges = [], pprChanges = [], doc: doc$12, story, replacementsMode }) => {
296999
297232
  const mergedSegments = mergeAdjacentSpans(spans.map((span) => ({
297000
297233
  attrs: readTrackedAttrs(span.mark, span.mark.type.name),
297001
297234
  span
@@ -297073,6 +297306,22 @@ var Node$13 = class Node$14 {
297073
297306
  mergedSegments.push(...logical.segments);
297074
297307
  appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
297075
297308
  }
297309
+ for (const ppr of pprChanges) {
297310
+ const logical = buildPprLogicalChange({
297311
+ ppr,
297312
+ doc: doc$12,
297313
+ story
297314
+ });
297315
+ if (!logical)
297316
+ continue;
297317
+ const internalKey = `pprchange:${ppr.from}`;
297318
+ if (changes.has(internalKey))
297319
+ continue;
297320
+ changes.set(internalKey, logical);
297321
+ if (logical.id && logical.id !== internalKey && !changes.has(logical.id))
297322
+ changes.set(logical.id, logical);
297323
+ appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
297324
+ }
297076
297325
  const segments = mergedSegments.slice().sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to);
297077
297326
  const graph = {
297078
297327
  changes,
@@ -297185,6 +297434,12 @@ var Node$13 = class Node$14 {
297185
297434
  type = CanonicalChangeType.Formatting;
297186
297435
  else
297187
297436
  type = "";
297437
+ if (type === CanonicalChangeType.Replacement && !(inserted.length && deleted.length)) {
297438
+ if (inserted.length)
297439
+ type = CanonicalChangeType.Insertion;
297440
+ else if (deleted.length)
297441
+ type = CanonicalChangeType.Deletion;
297442
+ }
297188
297443
  const subtype = subtypeFromChangeType(type) ?? "";
297189
297444
  const primary = segments[0]?.attrs ?? null;
297190
297445
  let replacement = null;
@@ -297321,6 +297576,90 @@ var Node$13 = class Node$14 {
297321
297576
  enumerable: false
297322
297577
  });
297323
297578
  return logical;
297579
+ }, buildPprLogicalChange = ({ ppr, doc: doc$12, story }) => {
297580
+ const from$1 = ppr.from;
297581
+ const to = ppr.to;
297582
+ if (!(from$1 < to))
297583
+ return null;
297584
+ const side = SegmentSide.Formatting;
297585
+ const attrs = {
297586
+ id: ppr.id,
297587
+ revisionGroupId: ppr.id,
297588
+ splitFromId: "",
297589
+ changeType: CanonicalChangeType.Formatting,
297590
+ replacementGroupId: "",
297591
+ replacementSideId: "",
297592
+ overlapParentId: "",
297593
+ sourceIds: {},
297594
+ sourceId: "",
297595
+ importedAuthor: "",
297596
+ origin: "",
297597
+ author: ppr.author,
297598
+ authorId: "",
297599
+ authorEmail: ppr.authorEmail,
297600
+ authorImage: ppr.authorImage,
297601
+ date: ppr.date,
297602
+ markType: "",
297603
+ side,
297604
+ subtype: ppr.subtype,
297605
+ explicitChangeType: CanonicalChangeType.Formatting,
297606
+ hasReviewMetadata: true
297607
+ };
297608
+ const segment = {
297609
+ segmentId: `${ppr.id}:pprchange:${from$1}:${to}:0`,
297610
+ changeId: ppr.id,
297611
+ markType: "",
297612
+ side,
297613
+ from: from$1,
297614
+ to,
297615
+ text: "",
297616
+ mark: null,
297617
+ markRuns: [],
297618
+ attrs,
297619
+ parentId: "",
297620
+ parentSide: "",
297621
+ overlapRole: "standalone",
297622
+ pprChange: true
297623
+ };
297624
+ if (doc$12)
297625
+ try {
297626
+ segment.text = doc$12.textBetween(from$1, to, " ", "");
297627
+ } catch {
297628
+ segment.text = "";
297629
+ }
297630
+ const segments = [segment];
297631
+ const logical = {
297632
+ id: ppr.id,
297633
+ type: CanonicalChangeType.Formatting,
297634
+ subtype: ppr.subtype,
297635
+ state: "open",
297636
+ segments,
297637
+ coverageSegments: [...segments],
297638
+ insertedSegments: [],
297639
+ deletedSegments: [],
297640
+ formattingSegments: [...segments],
297641
+ replacement: null,
297642
+ author: ppr.author,
297643
+ authorId: "",
297644
+ authorEmail: ppr.authorEmail,
297645
+ authorImage: ppr.authorImage,
297646
+ date: ppr.date,
297647
+ sourceIds: {},
297648
+ revisionGroupId: ppr.id,
297649
+ splitFromId: "",
297650
+ sourcePlatform: "",
297651
+ story,
297652
+ parent: null,
297653
+ children: [],
297654
+ before: [],
297655
+ after: [],
297656
+ excerpt: segment.text.length > 200 ? `${segment.text.slice(0, 200)}…` : segment.text
297657
+ };
297658
+ Object.defineProperty(logical, "pprChange", {
297659
+ value: ppr,
297660
+ enumerable: false
297661
+ });
297662
+ return logical;
297324
297663
  }, aggregateSourceIds = (segments) => {
297325
297664
  const out = {};
297326
297665
  const sorted = [...segments].sort((a2, b$1) => {
@@ -300035,6 +300374,10 @@ var Node$13 = class Node$14 {
300035
300374
  touchedChangeIds: applyResult.touchedChangeIds,
300036
300375
  diagnostics: plan.diagnostics
300037
300376
  };
300377
+ }, normalizeReplacementSide = (value) => {
300378
+ if (value === SegmentSide.Inserted || value === SegmentSide.Deleted)
300379
+ return value;
300380
+ return null;
300038
300381
  }, normalizeDecisionTarget = (target) => {
300039
300382
  if (!target || typeof target !== "object")
300040
300383
  return {
@@ -300048,11 +300391,18 @@ var Node$13 = class Node$14 {
300048
300391
  ok: false,
300049
300392
  failure: failure$3("INVALID_TARGET", 'target.kind = "id" requires a non-empty id.')
300050
300393
  };
300394
+ const side = normalizeReplacementSide(t.side);
300395
+ if (t.side != null && !side)
300396
+ return {
300397
+ ok: false,
300398
+ failure: failure$3("INVALID_TARGET", 'target.side must be "inserted" or "deleted" when provided.')
300399
+ };
300051
300400
  return {
300052
300401
  ok: true,
300053
300402
  value: {
300054
300403
  kind: "id",
300055
- id: t.id
300404
+ id: t.id,
300405
+ ...side ? { side } : {}
300056
300406
  }
300057
300407
  };
300058
300408
  }
@@ -300156,7 +300506,8 @@ var Node$13 = class Node$14 {
300156
300506
  ranges: change.segments.map((s2) => ({
300157
300507
  from: s2.from,
300158
300508
  to: s2.to
300159
- }))
300509
+ })),
300510
+ ...normalized.side ? { side: normalized.side } : {}
300160
300511
  }]
300161
300512
  };
300162
300513
  }
@@ -300399,7 +300750,7 @@ var Node$13 = class Node$14 {
300399
300750
  suppressedInsideTable.add(change.id);
300400
300751
  continue;
300401
300752
  }
300402
- if (isInsideStayingTable(change)) {
300753
+ if (!change.pprChange && isInsideStayingTable(change)) {
300403
300754
  const failureResult = planContainedInlineChild(change);
300404
300755
  if (failureResult)
300405
300756
  return {
@@ -300408,6 +300759,36 @@ var Node$13 = class Node$14 {
300408
300759
  };
300409
300760
  continue;
300410
300761
  }
300762
+ if (change.type === CanonicalChangeType.Replacement && selection.side) {
300763
+ touched.add(change.id);
300764
+ const sideResult = planReplacementSideDecision({
300765
+ ops,
300766
+ change,
300767
+ decision,
300768
+ side: selection.side,
300769
+ removedRanges,
300770
+ retired,
300771
+ resolvedRanges
300772
+ });
300773
+ if (!sideResult.ok)
300774
+ return {
300775
+ ok: false,
300776
+ failure: sideResult.failure
300777
+ };
300778
+ continue;
300779
+ }
300780
+ if (selection.side) {
300781
+ const standaloneSide = change.type === CanonicalChangeType.Insertion ? "inserted" : change.type === CanonicalChangeType.Deletion ? "deleted" : null;
300782
+ if (standaloneSide !== selection.side)
300783
+ return {
300784
+ ok: false,
300785
+ failure: failure$3("INVALID_TARGET", `target.side "${selection.side}" does not apply: this change is not a paired replacement${standaloneSide ? ` (its only side is "${standaloneSide}")` : ""}. The targeted side may have already been resolved.`, { details: {
300786
+ changeId: change.id,
300787
+ requestedSide: selection.side,
300788
+ currentSide: standaloneSide
300789
+ } })
300790
+ };
300791
+ }
300411
300792
  const isFull = selection.coverage === "full";
300412
300793
  if (!isFull) {
300413
300794
  if (change.type === CanonicalChangeType.Structural)
@@ -300430,14 +300811,26 @@ var Node$13 = class Node$14 {
300430
300811
  };
300431
300812
  }
300432
300813
  touched.add(change.id);
300433
- if (isFull)
300814
+ if (isFull && !change.pprChange)
300434
300815
  for (const segment of change.segments)
300435
300816
  resolvedRanges.push({
300436
300817
  from: segment.from,
300437
300818
  to: segment.to,
300438
300819
  cause: `${decision}:${change.id}`
300439
300820
  });
300440
- if (change.type === CanonicalChangeType.Structural) {
300821
+ if (change.pprChange) {
300822
+ const pprResult = planPprDecision({
300823
+ ops,
300824
+ change,
300825
+ decision,
300826
+ retired
300827
+ });
300828
+ if (!pprResult.ok)
300829
+ return {
300830
+ ok: false,
300831
+ failure: pprResult.failure
300832
+ };
300833
+ } else if (change.type === CanonicalChangeType.Structural) {
300441
300834
  const structuralResult = planStructuralDecision({
300442
300835
  ops,
300443
300836
  change,
@@ -300522,6 +300915,22 @@ var Node$13 = class Node$14 {
300522
300915
  continue;
300523
300916
  if (!isInsideStayingTable(change))
300524
300917
  continue;
300918
+ if (change.pprChange) {
300919
+ cascadedInsideStayingTable.add(change.id);
300920
+ touched.add(change.id);
300921
+ const pprResult = planPprDecision({
300922
+ ops,
300923
+ change,
300924
+ decision,
300925
+ retired
300926
+ });
300927
+ if (!pprResult.ok)
300928
+ return {
300929
+ ok: false,
300930
+ failure: pprResult.failure
300931
+ };
300932
+ continue;
300933
+ }
300525
300934
  const failureResult = planContainedInlineChild(change);
300526
300935
  if (failureResult)
300527
300936
  return {
@@ -300706,6 +301115,22 @@ var Node$13 = class Node$14 {
300706
301115
  });
300707
301116
  retired.add(change.id);
300708
301117
  return { ok: true };
301118
+ }, planPprDecision = ({ ops, change, decision, retired }) => {
301119
+ const ppr = change.pprChange;
301120
+ if (!ppr)
301121
+ return {
301122
+ ok: false,
301123
+ failure: failure$3("CAPABILITY_UNAVAILABLE", `change "${change.id}" is not a paragraph-property change.`)
301124
+ };
301125
+ ops.push({
301126
+ kind: "resolvePprChange",
301127
+ from: ppr.from,
301128
+ changeId: change.id,
301129
+ decision,
301130
+ formerProperties: ppr.formerProperties
301131
+ });
301132
+ retired.add(change.id);
301133
+ return { ok: true };
300709
301134
  }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
300710
301135
  const inserted = change.insertedSegments;
300711
301136
  const deleted = change.deletedSegments;
@@ -300790,6 +301215,55 @@ var Node$13 = class Node$14 {
300790
301215
  }
300791
301216
  retired.add(change.id);
300792
301217
  return { ok: true };
301218
+ }, planReplacementSideDecision = ({ ops, change, decision, side, removedRanges, resolvedRanges }) => {
301219
+ const inserted = change.insertedSegments;
301220
+ const deleted = change.deletedSegments;
301221
+ if (!inserted.length || !deleted.length)
301222
+ return {
301223
+ ok: false,
301224
+ failure: failure$3("PRECONDITION_FAILED", `replacement "${change.id}" missing inserted or deleted side.`)
301225
+ };
301226
+ const segments = side === SegmentSide.Inserted ? inserted : deleted;
301227
+ for (const seg of segments)
301228
+ resolvedRanges.push({
301229
+ from: seg.from,
301230
+ to: seg.to,
301231
+ cause: `${decision}-replacement-${side}:${change.id}`
301232
+ });
301233
+ const removeContent = (seg, cause) => {
301234
+ ops.push({
301235
+ kind: "removeContent",
301236
+ from: seg.from,
301237
+ to: seg.to,
301238
+ changeId: change.id,
301239
+ side
301240
+ });
301241
+ removedRanges.push({
301242
+ from: seg.from,
301243
+ to: seg.to,
301244
+ cause: `${cause}:${change.id}`
301245
+ });
301246
+ };
301247
+ const dropMark = (seg) => pushRemoveMarkOpsForSegment({
301248
+ ops,
301249
+ segment: seg,
301250
+ changeId: change.id,
301251
+ side
301252
+ });
301253
+ if (side === SegmentSide.Deleted)
301254
+ if (decision === "accept")
301255
+ for (const seg of deleted)
301256
+ removeContent(seg, "accept-replacement-deleted-side");
301257
+ else
301258
+ for (const seg of deleted)
301259
+ dropMark(seg);
301260
+ else if (decision === "accept")
301261
+ for (const seg of inserted)
301262
+ dropMark(seg);
301263
+ else
301264
+ for (const seg of inserted)
301265
+ removeContent(seg, "reject-replacement-inserted-side");
301266
+ return { ok: true };
300793
301267
  }, getParentRestoreContext = ({ graph, change }) => {
300794
301268
  const explicit = getExplicitParentRestoreContext({
300795
301269
  graph,
@@ -301158,6 +301632,31 @@ var Node$13 = class Node$14 {
301158
301632
  });
301159
301633
  continue;
301160
301634
  }
301635
+ if (op.kind === "resolvePprChange") {
301636
+ const mappedFrom = tr.mapping.map(op.from, 1);
301637
+ const node3 = tr.doc.nodeAt(mappedFrom);
301638
+ const pp = node3?.attrs?.paragraphProperties;
301639
+ if (node3 && pp && pp.change)
301640
+ if (op.decision === "accept") {
301641
+ const kept = { ...pp };
301642
+ delete kept.change;
301643
+ tr.setNodeMarkup(mappedFrom, undefined, {
301644
+ ...node3.attrs,
301645
+ paragraphProperties: kept
301646
+ });
301647
+ } else {
301648
+ const former = { ...op.formerProperties || {} };
301649
+ const nextAttrs = {
301650
+ ...node3.attrs,
301651
+ paragraphProperties: former,
301652
+ numberingProperties: former.numberingProperties ?? null
301653
+ };
301654
+ if (!former.numberingProperties)
301655
+ nextAttrs.listRendering = null;
301656
+ tr.setNodeMarkup(mappedFrom, undefined, nextAttrs);
301657
+ }
301658
+ continue;
301659
+ }
301161
301660
  }
301162
301661
  for (const op of contentOps)
301163
301662
  tr.step(new ReplaceStep(op.from, op.to, Slice.empty));
@@ -327366,13 +327865,13 @@ menclose::after {
327366
327865
  return;
327367
327866
  console.log(...args$1);
327368
327867
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
327369
- var init_src_bMRzO9Kl_es = __esm(() => {
327868
+ var init_src_CVmBLxZV_es = __esm(() => {
327370
327869
  init_rolldown_runtime_Bg48TavK_es();
327371
- init_SuperConverter_Ed3nFN54_es();
327870
+ init_SuperConverter_DlrS7cQT_es();
327372
327871
  init_jszip_C49i9kUs_es();
327373
327872
  init_xml_js_CqGKpaft_es();
327374
327873
  init_uuid_B2wVPhPi_es();
327375
- init_create_headless_toolbar_PSeH6IV5_es();
327874
+ init_create_headless_toolbar_Bm_c7KZd_es();
327376
327875
  init_constants_D9qj59G2_es();
327377
327876
  init_unified_BDuVPlMu_es();
327378
327877
  init_remark_gfm_BUJjZJLy_es();
@@ -328740,13 +329239,13 @@ var init_src_bMRzO9Kl_es = __esm(() => {
328740
329239
  },
328741
329240
  "lists.attach": {
328742
329241
  memberPath: "lists.attach",
328743
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
329242
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
328744
329243
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
328745
329244
  requiresDocumentContext: true,
328746
329245
  metadata: mutationOperation2({
328747
329246
  idempotency: "conditional",
328748
329247
  supportsDryRun: true,
328749
- supportsTrackedMode: false,
329248
+ supportsTrackedMode: true,
328750
329249
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
328751
329250
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
328752
329251
  }),
@@ -351346,7 +351845,7 @@ function print() { __p += __j.call(arguments, '') }
351346
351845
  })
351347
351846
  });
351348
351847
  },
351349
- acceptTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
351848
+ acceptTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
351350
351849
  return dispatchReviewDecision({
351351
351850
  editor,
351352
351851
  state,
@@ -351354,7 +351853,8 @@ function print() { __p += __j.call(arguments, '') }
351354
351853
  decision: "accept",
351355
351854
  target: {
351356
351855
  kind: "id",
351357
- id: id2
351856
+ id: id2,
351857
+ ...options.side ? { side: options.side } : {}
351358
351858
  }
351359
351859
  }).applied;
351360
351860
  },
@@ -351367,7 +351867,7 @@ function print() { __p += __j.call(arguments, '') }
351367
351867
  target: { kind: "all" }
351368
351868
  }).applied;
351369
351869
  },
351370
- rejectTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
351870
+ rejectTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
351371
351871
  return dispatchReviewDecision({
351372
351872
  editor,
351373
351873
  state,
@@ -351375,7 +351875,8 @@ function print() { __p += __j.call(arguments, '') }
351375
351875
  decision: "reject",
351376
351876
  target: {
351377
351877
  kind: "id",
351378
- id: id2
351878
+ id: id2,
351879
+ ...options.side ? { side: options.side } : {}
351379
351880
  }
351380
351881
  }).applied;
351381
351882
  },
@@ -370677,11 +371178,11 @@ function print() { __p += __j.call(arguments, '') }
370677
371178
  ]);
370678
371179
  });
370679
371180
 
370680
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DNNbMZCp.es.js
371181
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D2qFX5i6.es.js
370681
371182
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
370682
- var init_create_super_doc_ui_DNNbMZCp_es = __esm(() => {
370683
- init_SuperConverter_Ed3nFN54_es();
370684
- init_create_headless_toolbar_PSeH6IV5_es();
371183
+ var init_create_super_doc_ui_D2qFX5i6_es = __esm(() => {
371184
+ init_SuperConverter_DlrS7cQT_es();
371185
+ init_create_headless_toolbar_Bm_c7KZd_es();
370685
371186
  DEFAULT_TEXT_ALIGN_OPTIONS = [
370686
371187
  {
370687
371188
  label: "Left",
@@ -370972,15 +371473,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
370972
371473
 
370973
371474
  // ../../packages/superdoc/dist/super-editor.es.js
370974
371475
  var init_super_editor_es = __esm(() => {
370975
- init_src_bMRzO9Kl_es();
370976
- init_SuperConverter_Ed3nFN54_es();
371476
+ init_src_CVmBLxZV_es();
371477
+ init_SuperConverter_DlrS7cQT_es();
370977
371478
  init_jszip_C49i9kUs_es();
370978
371479
  init_xml_js_CqGKpaft_es();
370979
- init_create_headless_toolbar_PSeH6IV5_es();
371480
+ init_create_headless_toolbar_Bm_c7KZd_es();
370980
371481
  init_constants_D9qj59G2_es();
370981
371482
  init_unified_BDuVPlMu_es();
370982
371483
  init_DocxZipper_BzS208BW_es();
370983
- init_create_super_doc_ui_DNNbMZCp_es();
371484
+ init_create_super_doc_ui_D2qFX5i6_es();
370984
371485
  init_ui_CGB3qmy3_es();
370985
371486
  init_eventemitter3_UwU_CLPU_es();
370986
371487
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.17.0-next.44",
3
+ "version": "0.17.0-next.45",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,20 +26,20 @@
26
26
  "lib0": "^0.2.114",
27
27
  "typescript": "^5.9.2",
28
28
  "y-protocols": "^1.0.6",
29
+ "superdoc": "1.43.1",
29
30
  "@superdoc/document-api": "0.1.0-alpha.0",
30
- "@superdoc/super-editor": "0.0.1",
31
- "superdoc": "1.43.1"
31
+ "@superdoc/super-editor": "0.0.1"
32
32
  },
33
33
  "module": "src/index.ts",
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.44",
39
- "@superdoc-dev/cli-darwin-x64": "0.17.0-next.44",
40
- "@superdoc-dev/cli-linux-x64": "0.17.0-next.44",
41
- "@superdoc-dev/cli-linux-arm64": "0.17.0-next.44",
42
- "@superdoc-dev/cli-windows-x64": "0.17.0-next.44"
38
+ "@superdoc-dev/cli-darwin-arm64": "0.17.0-next.45",
39
+ "@superdoc-dev/cli-darwin-x64": "0.17.0-next.45",
40
+ "@superdoc-dev/cli-linux-x64": "0.17.0-next.45",
41
+ "@superdoc-dev/cli-linux-arm64": "0.17.0-next.45",
42
+ "@superdoc-dev/cli-windows-x64": "0.17.0-next.45"
43
43
  },
44
44
  "scripts": {
45
45
  "predev": "node scripts/ensure-superdoc-build.js",