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

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 +135 -28
  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-DKGc94QA.es.js
101809
- var exports_src_DKGc94QA_es = {};
101810
- __export(exports_src_DKGc94QA_es, {
101808
+ // ../../packages/superdoc/dist/chunks/src-DA7AHLPf.es.js
101809
+ var exports_src_DA7AHLPf_es = {};
101810
+ __export(exports_src_DA7AHLPf_es, {
101811
101811
  zt: () => defineMark,
101812
101812
  z: () => cM,
101813
101813
  yt: () => removeAwarenessStates,
@@ -116907,19 +116907,69 @@ function tablesInsertCellAdapter(editor, input2, options) {
116907
116907
  return buildTableSuccess(table2.address);
116908
116908
  try {
116909
116909
  const tr = editor.state.tr;
116910
- const tableStart = table2.candidate.pos + 1;
116910
+ const tablePos = table2.candidate.pos;
116911
+ const tableStart = tablePos + 1;
116911
116912
  const tableNode = table2.candidate.node;
116912
116913
  const map$22 = TableMap.get(tableNode);
116913
116914
  const schema = editor.state.schema;
116914
116915
  if (input2.mode === "shiftRight") {
116915
- const lastColIdx = rowIndex * map$22.width + (map$22.width - 1);
116916
- const lastCellPos = map$22.map[lastColIdx];
116917
- const lastCell = tableNode.nodeAt(lastCellPos);
116918
- if (lastCell)
116919
- tr.delete(tableStart + lastCellPos, tableStart + lastCellPos + lastCell.nodeSize);
116920
- const newCell = schema.nodes.tableCell.createAndFill();
116921
- const mappedCellPos = tr.mapping.map(cellPos);
116922
- tr.insert(mappedCellPos, newCell);
116916
+ const slotCount = map$22.width * map$22.height;
116917
+ if (new Set(map$22.map).size !== slotCount)
116918
+ return toTableFailure("INVALID_TARGET", "Cell insertion with shiftRight is not supported for merged cells in this version.");
116919
+ const makeEmptyCell = (preferHeader = false) => {
116920
+ const candidateType = preferHeader ? schema.nodes.tableHeader ?? schema.nodes.tableCell : schema.nodes.tableCell;
116921
+ return candidateType.createAndFill({
116922
+ sdBlockId: v4_default(),
116923
+ paraId: generateParaId()
116924
+ }) ?? candidateType.createAndFill();
116925
+ };
116926
+ const overflowRowCells = [];
116927
+ for (let col = 0;col < map$22.width; col++) {
116928
+ const templateOffset = map$22.map[(map$22.height - 1) * map$22.width + col];
116929
+ const templateCell = tableNode.nodeAt(templateOffset);
116930
+ overflowRowCells.push(makeEmptyCell(templateCell?.type.name === "tableHeader"));
116931
+ }
116932
+ const overflowRowAttrs = {
116933
+ ...tableNode.child(Math.max(0, map$22.height - 1)).attrs ?? {},
116934
+ sdBlockId: v4_default(),
116935
+ paraId: generateParaId()
116936
+ };
116937
+ const overflowRow = schema.nodes.tableRow.createAndFill(overflowRowAttrs, overflowRowCells) ?? schema.nodes.tableRow.create(overflowRowAttrs, overflowRowCells);
116938
+ if (!overflowRow)
116939
+ return toTableFailure("INVALID_TARGET", "Cell insertion could not construct an overflow row.");
116940
+ tr.insert(tablePos + tableNode.nodeSize - 1, overflowRow);
116941
+ const expandedTableNode = tr.doc.nodeAt(tablePos);
116942
+ if (!expandedTableNode || expandedTableNode.type.name !== "table")
116943
+ return toTableFailure("INVALID_TARGET", "Cell insertion could not locate expanded table state.");
116944
+ const expandedMap = TableMap.get(expandedTableNode);
116945
+ const expandedSlotCount = expandedMap.width * expandedMap.height;
116946
+ if (new Set(expandedMap.map).size !== expandedSlotCount)
116947
+ return toTableFailure("INVALID_TARGET", "Cell insertion with shiftRight produced an unsupported merged-table shape.");
116948
+ const rowMajorCells = [];
116949
+ for (let i$1 = 0;i$1 < expandedSlotCount; i$1++) {
116950
+ const offset$1 = expandedMap.map[i$1];
116951
+ const cell2 = expandedTableNode.nodeAt(offset$1);
116952
+ if (!cell2)
116953
+ return toTableFailure("INVALID_TARGET", "Cell insertion could not resolve expanded table cells.");
116954
+ rowMajorCells.push(cell2);
116955
+ }
116956
+ const targetLinearIndex = rowIndex * expandedMap.width + columnIndex;
116957
+ const targetOffset = expandedMap.map[targetLinearIndex];
116958
+ const targetCell = expandedTableNode.nodeAt(targetOffset);
116959
+ rowMajorCells.splice(targetLinearIndex, 0, makeEmptyCell(targetCell?.type.name === "tableHeader"));
116960
+ rowMajorCells.pop();
116961
+ const rebuiltRows = [];
116962
+ const rebuiltRowCount = rowMajorCells.length / expandedMap.width;
116963
+ for (let rebuiltRowIndex = 0;rebuiltRowIndex < rebuiltRowCount; rebuiltRowIndex++) {
116964
+ const rowAttrs = expandedTableNode.child(rebuiltRowIndex).attrs ?? {};
116965
+ const rowCells = rowMajorCells.slice(rebuiltRowIndex * expandedMap.width, (rebuiltRowIndex + 1) * expandedMap.width);
116966
+ const rebuiltRow = schema.nodes.tableRow.createAndFill(rowAttrs, rowCells) ?? schema.nodes.tableRow.create(rowAttrs, rowCells);
116967
+ if (!rebuiltRow)
116968
+ return toTableFailure("INVALID_TARGET", "Cell insertion could not construct a replacement row.");
116969
+ rebuiltRows.push(rebuiltRow);
116970
+ }
116971
+ const rebuiltTable = schema.nodes.table.create(expandedTableNode.attrs, rebuiltRows);
116972
+ tr.replaceWith(tablePos, tablePos + expandedTableNode.nodeSize, rebuiltTable);
116923
116973
  } else {
116924
116974
  const lastRowIdx = (map$22.height - 1) * map$22.width + columnIndex;
116925
116975
  const lastCellPos = map$22.map[lastRowIdx];
@@ -172993,7 +173043,7 @@ var Node$13 = class Node$14 {
172993
173043
  trackedChanges: context.trackedChanges ?? []
172994
173044
  });
172995
173045
  }, _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;
172996
- var init_src_DKGc94QA_es = __esm(() => {
173046
+ var init_src_DA7AHLPf_es = __esm(() => {
172997
173047
  init_rolldown_runtime_B2q5OVn9_es();
172998
173048
  init_SuperConverter_BSZgN87C_es();
172999
173049
  init_jszip_ChlR43oI_es();
@@ -203886,8 +203936,8 @@ function print() { __p += __j.call(arguments, '') }
203886
203936
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
203887
203937
  };
203888
203938
  stubFalse_default = stubFalse;
203889
- freeExports$2 = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
203890
- freeModule$2 = freeExports$2 && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
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;
203891
203941
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
203892
203942
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
203893
203943
  typedArrayTags = {};
@@ -203895,8 +203945,8 @@ function print() { __p += __j.call(arguments, '') }
203895
203945
  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;
203896
203946
  _baseIsTypedArray_default = baseIsTypedArray;
203897
203947
  _baseUnary_default = baseUnary;
203898
- freeExports$1 = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
203899
- freeModule$1 = freeExports$1 && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
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;
203900
203950
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
203901
203951
  _nodeUtil_default = function() {
203902
203952
  try {
@@ -204001,8 +204051,8 @@ function print() { __p += __j.call(arguments, '') }
204001
204051
  Stack.prototype.has = _stackHas_default;
204002
204052
  Stack.prototype.set = _stackSet_default;
204003
204053
  _Stack_default = Stack;
204004
- freeExports = typeof exports_src_DKGc94QA_es == "object" && exports_src_DKGc94QA_es && !exports_src_DKGc94QA_es.nodeType && exports_src_DKGc94QA_es;
204005
- freeModule = freeExports && typeof module_src_DKGc94QA_es == "object" && module_src_DKGc94QA_es && !module_src_DKGc94QA_es.nodeType && module_src_DKGc94QA_es;
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;
204006
204056
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
204007
204057
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
204008
204058
  _cloneBuffer_default = cloneBuffer;
@@ -211654,7 +211704,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
211654
211704
 
211655
211705
  // ../../packages/superdoc/dist/super-editor.es.js
211656
211706
  var init_super_editor_es = __esm(() => {
211657
- init_src_DKGc94QA_es();
211707
+ init_src_DA7AHLPf_es();
211658
211708
  init_SuperConverter_BSZgN87C_es();
211659
211709
  init_jszip_ChlR43oI_es();
211660
211710
  init_xml_js_DLE8mr0n_es();
@@ -272352,15 +272402,72 @@ function tablesInsertCellAdapter2(editor, input2, options) {
272352
272402
  const map8 = TableMap2.get(tableNode);
272353
272403
  const schema = editor.state.schema;
272354
272404
  if (input2.mode === "shiftRight") {
272355
- const lastColIdx = rowIndex * map8.width + (map8.width - 1);
272356
- const lastCellPos = map8.map[lastColIdx];
272357
- const lastCell = tableNode.nodeAt(lastCellPos);
272358
- if (lastCell) {
272359
- tr.delete(tableStart + lastCellPos, tableStart + lastCellPos + lastCell.nodeSize);
272405
+ const slotCount = map8.width * map8.height;
272406
+ const uniqueOffsets = new Set(map8.map);
272407
+ if (uniqueOffsets.size !== slotCount) {
272408
+ return toTableFailure2("INVALID_TARGET", "Cell insertion with shiftRight is not supported for merged cells in this version.");
272409
+ }
272410
+ const makeEmptyCell = (preferHeader = false) => {
272411
+ const candidateType = preferHeader ? schema.nodes.tableHeader ?? schema.nodes.tableCell : schema.nodes.tableCell;
272412
+ return candidateType.createAndFill({
272413
+ sdBlockId: v42(),
272414
+ paraId: generateParaId2()
272415
+ }) ?? candidateType.createAndFill();
272416
+ };
272417
+ const overflowRowCells = [];
272418
+ for (let col = 0;col < map8.width; col++) {
272419
+ const templateOffset = map8.map[(map8.height - 1) * map8.width + col];
272420
+ const templateCell = tableNode.nodeAt(templateOffset);
272421
+ overflowRowCells.push(makeEmptyCell(templateCell?.type.name === "tableHeader"));
272360
272422
  }
272361
- const newCell = schema.nodes.tableCell.createAndFill();
272362
- const mappedCellPos = tr.mapping.map(cellPos);
272363
- tr.insert(mappedCellPos, newCell);
272423
+ const templateRowAttrs = tableNode.child(Math.max(0, map8.height - 1)).attrs ?? {};
272424
+ const overflowRowAttrs = {
272425
+ ...templateRowAttrs,
272426
+ sdBlockId: v42(),
272427
+ paraId: generateParaId2()
272428
+ };
272429
+ const overflowRow = schema.nodes.tableRow.createAndFill(overflowRowAttrs, overflowRowCells) ?? schema.nodes.tableRow.create(overflowRowAttrs, overflowRowCells);
272430
+ if (!overflowRow) {
272431
+ return toTableFailure2("INVALID_TARGET", "Cell insertion could not construct an overflow row.");
272432
+ }
272433
+ tr.insert(tablePos + tableNode.nodeSize - 1, overflowRow);
272434
+ const expandedTableNode = tr.doc.nodeAt(tablePos);
272435
+ if (!expandedTableNode || expandedTableNode.type.name !== "table") {
272436
+ return toTableFailure2("INVALID_TARGET", "Cell insertion could not locate expanded table state.");
272437
+ }
272438
+ const expandedMap = TableMap2.get(expandedTableNode);
272439
+ const expandedSlotCount = expandedMap.width * expandedMap.height;
272440
+ if (new Set(expandedMap.map).size !== expandedSlotCount) {
272441
+ return toTableFailure2("INVALID_TARGET", "Cell insertion with shiftRight produced an unsupported merged-table shape.");
272442
+ }
272443
+ const rowMajorCells = [];
272444
+ for (let i5 = 0;i5 < expandedSlotCount; i5++) {
272445
+ const offset2 = expandedMap.map[i5];
272446
+ const cell2 = expandedTableNode.nodeAt(offset2);
272447
+ if (!cell2) {
272448
+ return toTableFailure2("INVALID_TARGET", "Cell insertion could not resolve expanded table cells.");
272449
+ }
272450
+ rowMajorCells.push(cell2);
272451
+ }
272452
+ const targetLinearIndex = rowIndex * expandedMap.width + columnIndex;
272453
+ const targetOffset = expandedMap.map[targetLinearIndex];
272454
+ const targetCell = expandedTableNode.nodeAt(targetOffset);
272455
+ rowMajorCells.splice(targetLinearIndex, 0, makeEmptyCell(targetCell?.type.name === "tableHeader"));
272456
+ rowMajorCells.pop();
272457
+ const rebuiltRows = [];
272458
+ const rebuiltRowCount = rowMajorCells.length / expandedMap.width;
272459
+ for (let rebuiltRowIndex = 0;rebuiltRowIndex < rebuiltRowCount; rebuiltRowIndex++) {
272460
+ const sourceRow = expandedTableNode.child(rebuiltRowIndex);
272461
+ const rowAttrs = sourceRow.attrs ?? {};
272462
+ const rowCells = rowMajorCells.slice(rebuiltRowIndex * expandedMap.width, (rebuiltRowIndex + 1) * expandedMap.width);
272463
+ const rebuiltRow = schema.nodes.tableRow.createAndFill(rowAttrs, rowCells) ?? schema.nodes.tableRow.create(rowAttrs, rowCells);
272464
+ if (!rebuiltRow) {
272465
+ return toTableFailure2("INVALID_TARGET", "Cell insertion could not construct a replacement row.");
272466
+ }
272467
+ rebuiltRows.push(rebuiltRow);
272468
+ }
272469
+ const rebuiltTable = schema.nodes.table.create(expandedTableNode.attrs, rebuiltRows);
272470
+ tr.replaceWith(tablePos, tablePos + expandedTableNode.nodeSize, rebuiltTable);
272364
272471
  } else {
272365
272472
  const lastRowIdx = (map8.height - 1) * map8.width + columnIndex;
272366
272473
  const lastCellPos = map8.map[lastRowIdx];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.32",
3
+ "version": "0.2.0-next.33",
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/super-editor": "0.0.1",
25
- "superdoc": "1.16.0"
24
+ "superdoc": "1.16.0",
25
+ "@superdoc/super-editor": "0.0.1"
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-arm64": "0.2.0-next.32",
33
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.32",
34
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.32",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.32",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.32"
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"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",