@superdoc-dev/cli 0.2.0-next.33 → 0.2.0-next.34

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 +124 -32
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -101805,9 +101805,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
101805
101805
  init_remark_gfm_z_sDF4ss_es();
101806
101806
  });
101807
101807
 
101808
- // ../../packages/superdoc/dist/chunks/src-DA7AHLPf.es.js
101809
- var exports_src_DA7AHLPf_es = {};
101810
- __export(exports_src_DA7AHLPf_es, {
101808
+ // ../../packages/superdoc/dist/chunks/src-DoNUa3rb.es.js
101809
+ var exports_src_DoNUa3rb_es = {};
101810
+ __export(exports_src_DoNUa3rb_es, {
101811
101811
  zt: () => defineMark,
101812
101812
  z: () => cM,
101813
101813
  yt: () => removeAwarenessStates,
@@ -116993,26 +116993,69 @@ function tablesInsertCellAdapter(editor, input2, options) {
116993
116993
  function tablesDeleteCellAdapter(editor, input2, options) {
116994
116994
  rejectTrackedMode("tables.deleteCell", options);
116995
116995
  const { table: table2, cellPos, cellNode, rowIndex, columnIndex } = resolveCellLocator(editor, input2, "tables.deleteCell");
116996
+ const row2 = table2.candidate.node.child(rowIndex);
116997
+ const deletedColspan = Math.max(1, cellNode.attrs.colspan || 1);
116998
+ const deletedColwidth = Array.isArray(cellNode.attrs.colwidth) ? [...cellNode.attrs.colwidth] : null;
116999
+ if (input2.mode === "shiftLeft" && row2.childCount <= 1)
117000
+ return toTableFailure("NO_OP", "Cannot shift-left delete the last remaining cell in a row.");
116996
117001
  if (options?.dryRun)
116997
117002
  return buildTableSuccess(table2.address);
116998
117003
  try {
116999
117004
  const tr = editor.state.tr;
117000
- const tableStart = table2.candidate.pos + 1;
117005
+ const tablePos = table2.candidate.pos;
117006
+ const tableStart = tablePos + 1;
117001
117007
  const tableNode = table2.candidate.node;
117002
117008
  const map$22 = TableMap.get(tableNode);
117003
117009
  const schema = editor.state.schema;
117004
117010
  tr.delete(cellPos, cellPos + cellNode.nodeSize);
117005
117011
  if (input2.mode === "shiftLeft") {
117006
- const row2 = tableNode.child(rowIndex);
117007
- tr.mapping.map(tableStart + map$22.positionAt(rowIndex, map$22.width - 1, tableNode));
117008
- const lastCell = row2.child(row2.childCount - 1);
117009
- tr.mapping.map(cellPos + cellNode.nodeSize + lastCell.nodeSize - cellNode.nodeSize);
117010
- let rowEndPos = table2.candidate.pos + 1;
117011
- for (let i$1 = 0;i$1 <= rowIndex; i$1++)
117012
- rowEndPos += tableNode.child(i$1).nodeSize;
117013
- const mappedRowEnd = tr.mapping.map(rowEndPos - 1);
117014
- const newCell = schema.nodes.tableCell.createAndFill();
117015
- tr.insert(mappedRowEnd, newCell);
117012
+ const currentTableNode = tr.doc.nodeAt(tablePos);
117013
+ if (!currentTableNode || currentTableNode.type.name !== "table")
117014
+ return toTableFailure("INVALID_TARGET", "Cell deletion could not locate the updated table.");
117015
+ const currentRow = currentTableNode.child(rowIndex);
117016
+ const lastCellIndex = currentRow.childCount - 1;
117017
+ const lastAttrs = currentRow.child(lastCellIndex).attrs;
117018
+ const tableCellProperties = lastAttrs.tableCellProperties ?? {};
117019
+ const lastRowspan = Math.max(1, lastAttrs.rowspan || 1);
117020
+ const hasVerticalMerge = tableCellProperties.vMerge != null;
117021
+ if (lastRowspan > 1 || hasVerticalMerge) {
117022
+ let rowEndPos = tablePos + 1;
117023
+ for (let i$1 = 0;i$1 <= rowIndex; i$1++)
117024
+ rowEndPos += currentTableNode.child(i$1).nodeSize;
117025
+ const mappedRowEnd = rowEndPos - 1;
117026
+ const newCell = schema.nodes.tableCell.createAndFill();
117027
+ tr.insert(mappedRowEnd, newCell);
117028
+ } else {
117029
+ const nextColspan = Math.max(1, lastAttrs.colspan || 1) + deletedColspan;
117030
+ const nextTableCellProps = { ...tableCellProperties };
117031
+ if (nextColspan > 1)
117032
+ nextTableCellProps.gridSpan = nextColspan;
117033
+ else
117034
+ delete nextTableCellProps.gridSpan;
117035
+ const nextColwidth = Array.isArray(lastAttrs.colwidth) ? [...lastAttrs.colwidth] : null;
117036
+ if (nextColwidth) {
117037
+ if (deletedColwidth)
117038
+ for (const width of deletedColwidth) {
117039
+ if (nextColwidth.length >= nextColspan)
117040
+ break;
117041
+ nextColwidth.push(typeof width === "number" ? width : 0);
117042
+ }
117043
+ while (nextColwidth.length < nextColspan)
117044
+ nextColwidth.push(0);
117045
+ }
117046
+ let rowOffset = 0;
117047
+ for (let i$1 = 0;i$1 < rowIndex; i$1++)
117048
+ rowOffset += currentTableNode.child(i$1).nodeSize;
117049
+ let lastCellOffset = rowOffset + 1;
117050
+ for (let i$1 = 0;i$1 < lastCellIndex; i$1++)
117051
+ lastCellOffset += currentRow.child(i$1).nodeSize;
117052
+ tr.setNodeMarkup(tableStart + lastCellOffset, null, {
117053
+ ...lastAttrs,
117054
+ colspan: nextColspan,
117055
+ colwidth: nextColwidth,
117056
+ tableCellProperties: nextTableCellProps
117057
+ });
117058
+ }
117016
117059
  } else {
117017
117060
  const lastRowIndex = map$22.height - 1;
117018
117061
  const colOffset = map$22.map[lastRowIndex * map$22.width + columnIndex];
@@ -173043,7 +173086,7 @@ var Node$13 = class Node$14 {
173043
173086
  trackedChanges: context.trackedChanges ?? []
173044
173087
  });
173045
173088
  }, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
173046
- var init_src_DA7AHLPf_es = __esm(() => {
173089
+ var init_src_DoNUa3rb_es = __esm(() => {
173047
173090
  init_rolldown_runtime_B2q5OVn9_es();
173048
173091
  init_SuperConverter_BSZgN87C_es();
173049
173092
  init_jszip_ChlR43oI_es();
@@ -203936,8 +203979,8 @@ function print() { __p += __j.call(arguments, '') }
203936
203979
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
203937
203980
  };
203938
203981
  stubFalse_default = stubFalse;
203939
- freeExports$2 = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
203940
- freeModule$2 = freeExports$2 && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
203982
+ freeExports$2 = typeof exports_src_DoNUa3rb_es == "object" && exports_src_DoNUa3rb_es && !exports_src_DoNUa3rb_es.nodeType && exports_src_DoNUa3rb_es;
203983
+ freeModule$2 = freeExports$2 && typeof module_src_DoNUa3rb_es == "object" && module_src_DoNUa3rb_es && !module_src_DoNUa3rb_es.nodeType && module_src_DoNUa3rb_es;
203941
203984
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
203942
203985
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
203943
203986
  typedArrayTags = {};
@@ -203945,8 +203988,8 @@ function print() { __p += __j.call(arguments, '') }
203945
203988
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
203946
203989
  _baseIsTypedArray_default = baseIsTypedArray;
203947
203990
  _baseUnary_default = baseUnary;
203948
- freeExports$1 = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
203949
- freeModule$1 = freeExports$1 && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
203991
+ freeExports$1 = typeof exports_src_DoNUa3rb_es == "object" && exports_src_DoNUa3rb_es && !exports_src_DoNUa3rb_es.nodeType && exports_src_DoNUa3rb_es;
203992
+ freeModule$1 = freeExports$1 && typeof module_src_DoNUa3rb_es == "object" && module_src_DoNUa3rb_es && !module_src_DoNUa3rb_es.nodeType && module_src_DoNUa3rb_es;
203950
203993
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
203951
203994
  _nodeUtil_default = function() {
203952
203995
  try {
@@ -204051,8 +204094,8 @@ function print() { __p += __j.call(arguments, '') }
204051
204094
  Stack.prototype.has = _stackHas_default;
204052
204095
  Stack.prototype.set = _stackSet_default;
204053
204096
  _Stack_default = Stack;
204054
- freeExports = typeof exports_src_DA7AHLPf_es == "object" && exports_src_DA7AHLPf_es && !exports_src_DA7AHLPf_es.nodeType && exports_src_DA7AHLPf_es;
204055
- freeModule = freeExports && typeof module_src_DA7AHLPf_es == "object" && module_src_DA7AHLPf_es && !module_src_DA7AHLPf_es.nodeType && module_src_DA7AHLPf_es;
204097
+ freeExports = typeof exports_src_DoNUa3rb_es == "object" && exports_src_DoNUa3rb_es && !exports_src_DoNUa3rb_es.nodeType && exports_src_DoNUa3rb_es;
204098
+ freeModule = freeExports && typeof module_src_DoNUa3rb_es == "object" && module_src_DoNUa3rb_es && !module_src_DoNUa3rb_es.nodeType && module_src_DoNUa3rb_es;
204056
204099
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
204057
204100
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
204058
204101
  _cloneBuffer_default = cloneBuffer;
@@ -211704,7 +211747,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
211704
211747
 
211705
211748
  // ../../packages/superdoc/dist/super-editor.es.js
211706
211749
  var init_super_editor_es = __esm(() => {
211707
- init_src_DA7AHLPf_es();
211750
+ init_src_DoNUa3rb_es();
211708
211751
  init_SuperConverter_BSZgN87C_es();
211709
211752
  init_jszip_ChlR43oI_es();
211710
211753
  init_xml_js_DLE8mr0n_es();
@@ -272493,6 +272536,12 @@ function tablesDeleteCellAdapter2(editor, input2, options) {
272493
272536
  rejectTrackedMode2("tables.deleteCell", options);
272494
272537
  const resolved = resolveCellLocator2(editor, input2, "tables.deleteCell");
272495
272538
  const { table: table2, cellPos, cellNode, rowIndex, columnIndex } = resolved;
272539
+ const row2 = table2.candidate.node.child(rowIndex);
272540
+ const deletedColspan = Math.max(1, cellNode.attrs.colspan || 1);
272541
+ const deletedColwidth = Array.isArray(cellNode.attrs.colwidth) ? [...cellNode.attrs.colwidth] : null;
272542
+ if (input2.mode === "shiftLeft" && row2.childCount <= 1) {
272543
+ return toTableFailure2("NO_OP", "Cannot shift-left delete the last remaining cell in a row.");
272544
+ }
272496
272545
  if (options?.dryRun) {
272497
272546
  return buildTableSuccess2(table2.address);
272498
272547
  }
@@ -272505,16 +272554,59 @@ function tablesDeleteCellAdapter2(editor, input2, options) {
272505
272554
  const schema = editor.state.schema;
272506
272555
  tr.delete(cellPos, cellPos + cellNode.nodeSize);
272507
272556
  if (input2.mode === "shiftLeft") {
272508
- const row2 = tableNode.child(rowIndex);
272509
- const rowEnd = tr.mapping.map(tableStart + map8.positionAt(rowIndex, map8.width - 1, tableNode));
272510
- const lastCell = row2.child(row2.childCount - 1);
272511
- const insertPos = tr.mapping.map(cellPos + cellNode.nodeSize + lastCell.nodeSize - cellNode.nodeSize);
272512
- let rowEndPos = table2.candidate.pos + 1;
272513
- for (let i5 = 0;i5 <= rowIndex; i5++)
272514
- rowEndPos += tableNode.child(i5).nodeSize;
272515
- const mappedRowEnd = tr.mapping.map(rowEndPos - 1);
272516
- const newCell = schema.nodes.tableCell.createAndFill();
272517
- tr.insert(mappedRowEnd, newCell);
272557
+ const currentTableNode = tr.doc.nodeAt(tablePos);
272558
+ if (!currentTableNode || currentTableNode.type.name !== "table") {
272559
+ return toTableFailure2("INVALID_TARGET", "Cell deletion could not locate the updated table.");
272560
+ }
272561
+ const currentRow = currentTableNode.child(rowIndex);
272562
+ const lastCellIndex = currentRow.childCount - 1;
272563
+ const lastCell = currentRow.child(lastCellIndex);
272564
+ const lastAttrs = lastCell.attrs;
272565
+ const tableCellProperties = lastAttrs.tableCellProperties ?? {};
272566
+ const lastRowspan = Math.max(1, lastAttrs.rowspan || 1);
272567
+ const hasVerticalMerge = tableCellProperties.vMerge != null;
272568
+ if (lastRowspan > 1 || hasVerticalMerge) {
272569
+ let rowEndPos = tablePos + 1;
272570
+ for (let i5 = 0;i5 <= rowIndex; i5++)
272571
+ rowEndPos += currentTableNode.child(i5).nodeSize;
272572
+ const mappedRowEnd = rowEndPos - 1;
272573
+ const newCell = schema.nodes.tableCell.createAndFill();
272574
+ tr.insert(mappedRowEnd, newCell);
272575
+ } else {
272576
+ const lastColspan = Math.max(1, lastAttrs.colspan || 1);
272577
+ const nextColspan = lastColspan + deletedColspan;
272578
+ const nextTableCellProps = {
272579
+ ...tableCellProperties
272580
+ };
272581
+ if (nextColspan > 1)
272582
+ nextTableCellProps.gridSpan = nextColspan;
272583
+ else
272584
+ delete nextTableCellProps.gridSpan;
272585
+ const nextColwidth = Array.isArray(lastAttrs.colwidth) ? [...lastAttrs.colwidth] : null;
272586
+ if (nextColwidth) {
272587
+ if (deletedColwidth) {
272588
+ for (const width of deletedColwidth) {
272589
+ if (nextColwidth.length >= nextColspan)
272590
+ break;
272591
+ nextColwidth.push(typeof width === "number" ? width : 0);
272592
+ }
272593
+ }
272594
+ while (nextColwidth.length < nextColspan)
272595
+ nextColwidth.push(0);
272596
+ }
272597
+ let rowOffset = 0;
272598
+ for (let i5 = 0;i5 < rowIndex; i5++)
272599
+ rowOffset += currentTableNode.child(i5).nodeSize;
272600
+ let lastCellOffset = rowOffset + 1;
272601
+ for (let i5 = 0;i5 < lastCellIndex; i5++)
272602
+ lastCellOffset += currentRow.child(i5).nodeSize;
272603
+ tr.setNodeMarkup(tableStart + lastCellOffset, null, {
272604
+ ...lastAttrs,
272605
+ colspan: nextColspan,
272606
+ colwidth: nextColwidth,
272607
+ tableCellProperties: nextTableCellProps
272608
+ });
272609
+ }
272518
272610
  } else {
272519
272611
  const lastRowIndex = map8.height - 1;
272520
272612
  const colOffset = map8.map[lastRowIndex * map8.width + columnIndex];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.33",
3
+ "version": "0.2.0-next.34",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,19 +21,19 @@
21
21
  "typescript": "^5.9.2",
22
22
  "@superdoc/document-api": "0.0.1",
23
23
  "@superdoc/pm-adapter": "0.0.0",
24
- "superdoc": "1.16.0",
25
- "@superdoc/super-editor": "0.0.1"
24
+ "@superdoc/super-editor": "0.0.1",
25
+ "superdoc": "1.16.0"
26
26
  },
27
27
  "module": "src/index.ts",
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.33",
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.33",
34
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.33",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.33",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.33"
32
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.34",
33
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.34",
34
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.34",
35
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.34",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.34"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",