@superdoc-dev/cli 0.3.0-next.48 → 0.3.0-next.49

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 +145 -33
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -39922,7 +39922,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
39922
39922
  emptyOptions2 = {};
39923
39923
  });
39924
39924
 
39925
- // ../../packages/superdoc/dist/chunks/SuperConverter--IVMRugL.es.js
39925
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DvkQFRg9.es.js
39926
39926
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
39927
39927
  const fieldValue = extension$1.config[field];
39928
39928
  if (typeof fieldValue === "function")
@@ -65485,6 +65485,7 @@ function importCommentData({ docx, editor, converter }) {
65485
65485
  const trackedChange = attributes["custom:trackedChange"] === "true";
65486
65486
  const trackedChangeType = attributes["custom:trackedChangeType"];
65487
65487
  const trackedChangeText = attributes["custom:trackedChangeText"] !== "null" ? attributes["custom:trackedChangeText"] : null;
65488
+ const trackedChangeDisplayType = attributes["custom:trackedChangeDisplayType"] !== "null" ? attributes["custom:trackedChangeDisplayType"] : null;
65488
65489
  const trackedDeletedText = attributes["custom:trackedDeletedText"] !== "null" ? attributes["custom:trackedDeletedText"] : null;
65489
65490
  const unixTimestampMs = new Date(createdDate).getTime();
65490
65491
  const parsedElements = nodeListHandler.handler({
@@ -65510,6 +65511,7 @@ function importCommentData({ docx, editor, converter }) {
65510
65511
  trackedChange,
65511
65512
  trackedChangeText,
65512
65513
  trackedChangeType,
65514
+ trackedChangeDisplayType,
65513
65515
  trackedDeletedText,
65514
65516
  isDone: false,
65515
65517
  origin: converter?.documentOrigin || "word",
@@ -72182,7 +72184,7 @@ var isRegExp = (value) => {
72182
72184
  return true;
72183
72185
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
72184
72186
  return objectIncludes(attrsA, attrsB);
72185
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
72187
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
72186
72188
  return SuperConverter.toCssFontFamily;
72187
72189
  }, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, getSpacingStyle = (spacing, isListItem$1) => {
72188
72190
  let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
@@ -85455,6 +85457,7 @@ var isRegExp = (value) => {
85455
85457
  "custom:trackedChange": comment.trackedChange,
85456
85458
  "custom:trackedChangeText": comment.trackedChangeText || null,
85457
85459
  "custom:trackedChangeType": comment.trackedChangeType,
85460
+ "custom:trackedChangeDisplayType": comment.trackedChangeDisplayType || null,
85458
85461
  "custom:trackedDeletedText": comment.deletedText || null
85459
85462
  };
85460
85463
  if (comment?.parentCommentId) {
@@ -85501,6 +85504,7 @@ var isRegExp = (value) => {
85501
85504
  "custom:trackedChange": commentDef.attributes["custom:trackedChange"],
85502
85505
  "custom:trackedChangeText": commentDef.attributes["custom:trackedChangeText"],
85503
85506
  "custom:trackedChangeType": commentDef.attributes["custom:trackedChangeType"],
85507
+ "custom:trackedChangeDisplayType": commentDef.attributes["custom:trackedChangeDisplayType"],
85504
85508
  "custom:trackedDeletedText": commentDef.attributes["custom:trackedDeletedText"],
85505
85509
  "xmlns:custom": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
85506
85510
  };
@@ -86021,7 +86025,7 @@ var isRegExp = (value) => {
86021
86025
  state.kern = kernNode.attributes["w:val"];
86022
86026
  }
86023
86027
  }, SuperConverter;
86024
- var init_SuperConverter_IVMRugL_es = __esm(() => {
86028
+ var init_SuperConverter_DvkQFRg9_es = __esm(() => {
86025
86029
  init_rolldown_runtime_B2q5OVn9_es();
86026
86030
  init_jszip_ChlR43oI_es();
86027
86031
  init_xml_js_BtmJ6bNs_es();
@@ -100512,6 +100516,15 @@ var init_SuperConverter_IVMRugL_es = __esm(() => {
100512
100516
  attributes: attributes_default$6
100513
100517
  };
100514
100518
  translator$3 = NodeTranslator.from(config$36);
100519
+ TrackedFormatMarkNames = [
100520
+ "bold",
100521
+ "italic",
100522
+ "strike",
100523
+ "underline",
100524
+ "textStyle",
100525
+ "highlight",
100526
+ "link"
100527
+ ];
100515
100528
  TABLE_FALLBACK_BORDER = {
100516
100529
  val: "single",
100517
100530
  size: 4,
@@ -148837,7 +148850,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
148837
148850
  init_remark_gfm_z_sDF4ss_es();
148838
148851
  });
148839
148852
 
148840
- // ../../packages/superdoc/dist/chunks/src-C9IXXt7g.es.js
148853
+ // ../../packages/superdoc/dist/chunks/src-BeJRbQ1S.es.js
148841
148854
  function deleteProps(obj, propOrProps) {
148842
148855
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
148843
148856
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -207989,6 +208002,102 @@ var Node$13 = class Node$14 {
207989
208002
  if (isActive$1 && activeOverride)
207990
208003
  return activeOverride;
207991
208004
  return applyAlphaToHex(baseColor, clampOpacity(isActive$1 ? highlightOpacity.active : highlightOpacity.inactive) ?? (isActive$1 ? DEFAULT_ACTIVE_ALPHA : DEFAULT_INACTIVE_ALPHA));
208005
+ }, HyperlinkAddedDisplayType = "hyperlinkAdded", HyperlinkModifiedDisplayType = "hyperlinkModified", getMarkSnapshots = (attrs = {}) => {
208006
+ return {
208007
+ before: Array.isArray(attrs.before) ? attrs.before : [],
208008
+ after: Array.isArray(attrs.after) ? attrs.after : []
208009
+ };
208010
+ }, findSnapshotByType = (snapshots, type) => {
208011
+ return snapshots.find((snapshot2) => snapshot2?.type === type) ?? null;
208012
+ }, getNodeText = (nodes = []) => {
208013
+ return nodes.map((node3) => node3?.text || node3?.textContent || "").join("").trim();
208014
+ }, getHyperlinkTarget = (linkSnapshot) => {
208015
+ const href = linkSnapshot?.attrs?.href;
208016
+ if (typeof href === "string" && href.trim().length > 0)
208017
+ return href.trim();
208018
+ const anchor = linkSnapshot?.attrs?.anchor;
208019
+ if (typeof anchor === "string" && anchor.trim().length > 0)
208020
+ return `#${anchor.trim()}`;
208021
+ return null;
208022
+ }, getLiveLinkMark = (nodes = []) => {
208023
+ for (const node3 of nodes) {
208024
+ const linkMark = node3?.marks?.find((mark2) => mark2?.type?.name === "link");
208025
+ if (linkMark)
208026
+ return linkMark;
208027
+ }
208028
+ return null;
208029
+ }, getHyperlinkLabel = ({ linkSnapshot, nodes }) => {
208030
+ return getHyperlinkTarget(linkSnapshot) || (typeof linkSnapshot?.attrs?.text === "string" && linkSnapshot.attrs.text.trim().length > 0 ? linkSnapshot.attrs.text.trim() : null) || getNodeText(nodes);
208031
+ }, getAddedMarkTypes = ({ before, after }) => {
208032
+ const beforeTypes = new Set(before.map((snapshot2) => snapshot2?.type).filter(Boolean));
208033
+ return [...new Set(after.map((snapshot2) => snapshot2?.type).filter(Boolean))].filter((type) => !beforeTypes.has(type));
208034
+ }, getRemovedMarkTypes = ({ before, after }) => {
208035
+ const beforeTypes = new Set(before.map((snapshot2) => snapshot2?.type).filter(Boolean));
208036
+ const afterTypes = new Set(after.map((snapshot2) => snapshot2?.type).filter(Boolean));
208037
+ return [...beforeTypes].filter((type) => !afterTypes.has(type));
208038
+ }, isUnderlineOnlyFormatDelta = ({ before, after }) => {
208039
+ const addedTypes = getAddedMarkTypes({
208040
+ before,
208041
+ after
208042
+ });
208043
+ return getRemovedMarkTypes({
208044
+ before,
208045
+ after
208046
+ }).length === 0 && addedTypes.length === 1 && addedTypes[0] === "underline";
208047
+ }, snapshotAttrsEqual = (a2, b$1) => {
208048
+ if (a2 === b$1)
208049
+ return true;
208050
+ if (!a2 || !b$1)
208051
+ return false;
208052
+ const keysA = Object.keys(a2);
208053
+ const keysB = Object.keys(b$1);
208054
+ if (keysA.length !== keysB.length)
208055
+ return false;
208056
+ return keysA.every((key$1) => {
208057
+ const valA = a2[key$1];
208058
+ const valB = b$1[key$1];
208059
+ if (valA == null && valB == null)
208060
+ return true;
208061
+ return valA === valB;
208062
+ });
208063
+ }, resolveTrackedFormatDisplay = ({ attrs = {}, nodes = [] }) => {
208064
+ const { before, after } = getMarkSnapshots(attrs);
208065
+ const beforeLink = findSnapshotByType(before, "link");
208066
+ const afterLink = findSnapshotByType(after, "link");
208067
+ const inferredLiveLink = !beforeLink && !afterLink && isUnderlineOnlyFormatDelta({
208068
+ before,
208069
+ after
208070
+ }) ? getLiveLinkMark(nodes) : null;
208071
+ const addedLink = afterLink || inferredLiveLink;
208072
+ if (beforeLink && addedLink) {
208073
+ if (snapshotAttrsEqual(beforeLink.attrs, addedLink.attrs))
208074
+ return {
208075
+ trackedChangeDisplayType: null,
208076
+ trackedChangeText: ""
208077
+ };
208078
+ const trackedChangeText$1 = getHyperlinkLabel({
208079
+ linkSnapshot: addedLink,
208080
+ nodes
208081
+ });
208082
+ if (!trackedChangeText$1)
208083
+ return null;
208084
+ return {
208085
+ trackedChangeDisplayType: HyperlinkModifiedDisplayType,
208086
+ trackedChangeText: trackedChangeText$1
208087
+ };
208088
+ }
208089
+ if (!addedLink)
208090
+ return null;
208091
+ const trackedChangeText = getHyperlinkLabel({
208092
+ linkSnapshot: addedLink,
208093
+ nodes
208094
+ });
208095
+ if (!trackedChangeText)
208096
+ return null;
208097
+ return {
208098
+ trackedChangeDisplayType: HyperlinkAddedDisplayType,
208099
+ trackedChangeText
208100
+ };
207992
208101
  }, normalizeCommentEventPayload = ({ conversation, editorOptions, fallbackCommentId, fallbackInternal }) => {
207993
208102
  const { user, documentId } = editorOptions || {};
207994
208103
  const normalized = {
@@ -208220,6 +208329,7 @@ var Node$13 = class Node$14 {
208220
208329
  }, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isDeletionInsertion }) => {
208221
208330
  let trackedChangeText = "";
208222
208331
  let deletionText = "";
208332
+ let trackedChangeDisplayType = null;
208223
208333
  if (trackedChangeType === "trackDelete" || isDeletionInsertion)
208224
208334
  deletionText = nodes.reduce((acc, node3) => {
208225
208335
  if (!node3.marks.find((nodeMark) => nodeMark.type.name === "trackDelete"))
@@ -208236,27 +208346,43 @@ var Node$13 = class Node$14 {
208236
208346
  acc += nodeText;
208237
208347
  return acc;
208238
208348
  }, "");
208239
- if (trackedChangeType === "trackFormat")
208240
- trackedChangeText = translateFormatChangesToEnglish(normalizeFormatAttrsForCommentText(mark2.attrs, nodes));
208349
+ if (trackedChangeType === "trackFormat") {
208350
+ const normalizedFormatAttrs = normalizeFormatAttrsForCommentText(mark2.attrs, nodes);
208351
+ const trackedFormatDisplay = resolveTrackedFormatDisplay({
208352
+ attrs: normalizedFormatAttrs,
208353
+ nodes
208354
+ });
208355
+ if (trackedFormatDisplay) {
208356
+ trackedChangeText = trackedFormatDisplay.trackedChangeText;
208357
+ trackedChangeDisplayType = trackedFormatDisplay.trackedChangeDisplayType;
208358
+ } else
208359
+ trackedChangeText = translateFormatChangesToEnglish(normalizedFormatAttrs);
208360
+ }
208241
208361
  return {
208242
208362
  deletionText,
208243
- trackedChangeText
208363
+ trackedChangeText,
208364
+ trackedChangeDisplayType
208244
208365
  };
208245
208366
  }, createOrUpdateTrackedChangeComment = ({ event, marks, deletionNodes, nodes, newEditorState, documentId, trackedChangesForId }) => {
208246
- const trackedMark = marks.insertedMark || marks.deletionMark || marks.formatMark;
208367
+ const node3 = nodes[0];
208368
+ const fallbackTrackedMark = marks.insertedMark || marks.deletionMark || marks.formatMark;
208369
+ if (!fallbackTrackedMark)
208370
+ return;
208371
+ const fallbackTrackedMarkId = fallbackTrackedMark.attrs?.id;
208372
+ const trackedChangesWithId = trackedChangesForId || getTrackChanges(newEditorState, fallbackTrackedMarkId);
208373
+ const liveFormatMark = trackedChangesWithId.find(({ mark: mark2 }) => mark2.type.name === "trackFormat")?.mark ?? null;
208374
+ const trackedMark = marks.insertedMark || marks.deletionMark || liveFormatMark || marks.formatMark;
208247
208375
  const { type, attrs } = trackedMark;
208248
208376
  const { name: trackedChangeType } = type;
208249
208377
  const { author, authorEmail, authorImage, date, importedAuthor } = attrs;
208250
208378
  const id2 = attrs.id;
208251
- const node3 = nodes[0];
208252
- const trackedChangesWithId = trackedChangesForId || getTrackChanges(newEditorState, id2);
208253
208379
  let isDeletionInsertion = !!(marks.insertedMark && marks.deletionMark);
208254
208380
  if (!isDeletionInsertion) {
208255
208381
  const hasInsertMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackInsertMarkName);
208256
208382
  const hasDeleteMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackDeleteMarkName);
208257
208383
  isDeletionInsertion = hasInsertMark && hasDeleteMark;
208258
208384
  }
208259
- let nodesWithMark = [];
208385
+ const nodesWithMark = [];
208260
208386
  trackedChangesWithId.forEach(({ from: from$1, to }) => {
208261
208387
  newEditorState.doc.nodesBetween(from$1, to, (node$1) => {
208262
208388
  if (node$1.isText) {
@@ -208277,8 +208403,7 @@ var Node$13 = class Node$14 {
208277
208403
  nodesToUse = nodesWithMark.length ? nodesWithMark : node3 ? [node3] : [];
208278
208404
  if (!nodesToUse.length)
208279
208405
  return;
208280
- const { deletionText, trackedChangeText } = getTrackedChangeText({
208281
- state: newEditorState,
208406
+ const { deletionText, trackedChangeText, trackedChangeDisplayType } = getTrackedChangeText({
208282
208407
  nodes: nodesToUse,
208283
208408
  mark: trackedMark,
208284
208409
  trackedChangeType,
@@ -208294,6 +208419,7 @@ var Node$13 = class Node$14 {
208294
208419
  changeId: id2,
208295
208420
  trackedChangeType: isDeletionInsertion ? "both" : trackedChangeType,
208296
208421
  trackedChangeText,
208422
+ trackedChangeDisplayType,
208297
208423
  deletedText: marks.deletionMark ? deletionText : null,
208298
208424
  author,
208299
208425
  authorEmail,
@@ -208626,14 +208752,7 @@ var Node$13 = class Node$14 {
208626
208752
  const existingChangeMark = liveMarks.find((mark2) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark2.type.name));
208627
208753
  const wid = existingChangeMark ? existingChangeMark.attrs.id : sharedWid ?? (sharedWid = v4_default());
208628
208754
  newTr.addMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), step3.mark);
208629
- if ([
208630
- "bold",
208631
- "italic",
208632
- "strike",
208633
- "underline",
208634
- "textStyle",
208635
- "highlight"
208636
- ].includes(step3.mark.type.name) && !hasMatchingMark(liveMarks, step3.mark)) {
208755
+ if (TrackedFormatMarkNames.includes(step3.mark.type.name) && !hasMatchingMark(liveMarks, step3.mark)) {
208637
208756
  const formatChangeMark = liveMarks.find((mark2) => mark2.type.name === TrackFormatMarkName);
208638
208757
  let after = [];
208639
208758
  let before = [];
@@ -208699,14 +208818,7 @@ var Node$13 = class Node$14 {
208699
208818
  to: rangeTo
208700
208819
  });
208701
208820
  newTr.removeMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), step3.mark);
208702
- if ([
208703
- "bold",
208704
- "italic",
208705
- "strike",
208706
- "underline",
208707
- "textStyle",
208708
- "highlight"
208709
- ].includes(step3.mark.type.name) && hasMatchingMark(liveMarksBeforeRemove, step3.mark)) {
208821
+ if (TrackedFormatMarkNames.includes(step3.mark.type.name) && hasMatchingMark(liveMarksBeforeRemove, step3.mark)) {
208710
208822
  const formatChangeMark = liveMarksBeforeRemove.find((mark2) => mark2.type.name === TrackFormatMarkName);
208711
208823
  let after = [];
208712
208824
  let before = [];
@@ -229174,9 +229286,9 @@ var Node$13 = class Node$14 {
229174
229286
  return false;
229175
229287
  return Boolean(checker(attrs));
229176
229288
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
229177
- var init_src_C9IXXt7g_es = __esm(() => {
229289
+ var init_src_BeJRbQ1S_es = __esm(() => {
229178
229290
  init_rolldown_runtime_B2q5OVn9_es();
229179
- init_SuperConverter_IVMRugL_es();
229291
+ init_SuperConverter_DvkQFRg9_es();
229180
229292
  init_jszip_ChlR43oI_es();
229181
229293
  init_uuid_qzgm05fK_es();
229182
229294
  init_constants_ep1_Gwqi_es();
@@ -262537,8 +262649,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
262537
262649
 
262538
262650
  // ../../packages/superdoc/dist/super-editor.es.js
262539
262651
  var init_super_editor_es = __esm(() => {
262540
- init_src_C9IXXt7g_es();
262541
- init_SuperConverter_IVMRugL_es();
262652
+ init_src_BeJRbQ1S_es();
262653
+ init_SuperConverter_DvkQFRg9_es();
262542
262654
  init_jszip_ChlR43oI_es();
262543
262655
  init_xml_js_BtmJ6bNs_es();
262544
262656
  init_constants_ep1_Gwqi_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.48",
3
+ "version": "0.3.0-next.49",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.48",
34
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.48",
35
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.48",
36
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.48",
37
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.48"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.49",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.49",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.49",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.49",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.49"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",