@superdoc-dev/cli 0.3.0-next.25 → 0.3.0-next.26

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 +61 -32
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -144352,7 +144352,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
144352
144352
  init_remark_gfm_z_sDF4ss_es();
144353
144353
  });
144354
144354
 
144355
- // ../../packages/superdoc/dist/chunks/src-zd0A71x4.es.js
144355
+ // ../../packages/superdoc/dist/chunks/src-B0uLvfdR.es.js
144356
144356
  function deleteProps(obj, propOrProps) {
144357
144357
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
144358
144358
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -162318,6 +162318,18 @@ function getTableColumnCount(tableNode) {
162318
162318
  }
162319
162319
  return count;
162320
162320
  }
162321
+ function resolvePostMutationTableAddress(editor, preMutationPos, preMutationNodeId, tr) {
162322
+ const index2 = getBlockIndex(editor);
162323
+ const mappedPos = tr.mapping.map(preMutationPos);
162324
+ const candidate = index2.candidates.find((c) => c.pos === mappedPos && c.nodeType === "table");
162325
+ if (candidate)
162326
+ return toBlockAddress(candidate);
162327
+ try {
162328
+ const found2 = findBlockByNodeIdOnly(index2, preMutationNodeId);
162329
+ if (found2.nodeType === "table")
162330
+ return toBlockAddress(found2);
162331
+ } catch {}
162332
+ }
162321
162333
  function toTableFailure(code7, message, details) {
162322
162334
  return {
162323
162335
  success: false,
@@ -163017,14 +163029,14 @@ function tablesClearContentsAdapter(editor, input2, options) {
163017
163029
  applyDirectMutationMeta(tr);
163018
163030
  editor.dispatch(tr);
163019
163031
  clearIndexCache(editor);
163020
- return buildTableSuccess(address2);
163032
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
163021
163033
  } catch {
163022
163034
  return toTableFailure("INVALID_TARGET", "Table content clearing could not be applied.");
163023
163035
  }
163024
163036
  }
163025
163037
  function tablesMoveAdapter(editor, input2, options) {
163026
163038
  rejectTrackedMode("tables.move", options);
163027
- const { candidate } = resolveTableLocator(editor, input2, "tables.move");
163039
+ const { candidate, address: address2 } = resolveTableLocator(editor, input2, "tables.move");
163028
163040
  if (options?.dryRun)
163029
163041
  return buildTableSuccess(toBlockAddress(candidate));
163030
163042
  try {
@@ -163039,7 +163051,16 @@ function tablesMoveAdapter(editor, input2, options) {
163039
163051
  applyDirectMutationMeta(tr);
163040
163052
  editor.dispatch(tr);
163041
163053
  clearIndexCache(editor);
163042
- return buildTableSuccess();
163054
+ let freshAddress = resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr);
163055
+ if (!freshAddress) {
163056
+ const sdBlockId = tableSlice.attrs.sdBlockId;
163057
+ if (typeof sdBlockId === "string") {
163058
+ const found2 = getBlockIndex(editor).candidates.find((c) => c.nodeType === "table" && c.node.attrs.sdBlockId === sdBlockId);
163059
+ if (found2)
163060
+ freshAddress = toBlockAddress(found2);
163061
+ }
163062
+ }
163063
+ return buildTableSuccess(freshAddress);
163043
163064
  } catch {
163044
163065
  return toTableFailure("INVALID_TARGET", "Table move could not be applied.");
163045
163066
  }
@@ -163086,7 +163107,7 @@ function tablesSetLayoutAdapter(editor, input2, options) {
163086
163107
  applyDirectMutationMeta(tr);
163087
163108
  editor.dispatch(tr);
163088
163109
  clearIndexCache(editor);
163089
- return buildTableSuccess(address2);
163110
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
163090
163111
  } catch {
163091
163112
  return toTableFailure("INVALID_TARGET", "Table layout update could not be applied.");
163092
163113
  }
@@ -163112,7 +163133,7 @@ function tablesSetAltTextAdapter(editor, input2, options) {
163112
163133
  applyDirectMutationMeta(tr);
163113
163134
  editor.dispatch(tr);
163114
163135
  clearIndexCache(editor);
163115
- return buildTableSuccess(address2);
163136
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
163116
163137
  } catch {
163117
163138
  return toTableFailure("INVALID_TARGET", "Table alt text update could not be applied.");
163118
163139
  }
@@ -163144,7 +163165,7 @@ function tablesInsertRowAdapter(editor, input2, options) {
163144
163165
  applyDirectMutationMeta(tr);
163145
163166
  editor.dispatch(tr);
163146
163167
  clearIndexCache(editor);
163147
- return buildTableSuccess(table2.address);
163168
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163148
163169
  } catch {
163149
163170
  return toTableFailure("INVALID_TARGET", "Row insertion could not be applied.");
163150
163171
  }
@@ -163200,7 +163221,7 @@ function tablesDeleteRowAdapter(editor, input2, options) {
163200
163221
  applyDirectMutationMeta(tr);
163201
163222
  editor.dispatch(tr);
163202
163223
  clearIndexCache(editor);
163203
- return buildTableSuccess(table2.address);
163224
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163204
163225
  } catch {
163205
163226
  return toTableFailure("INVALID_TARGET", "Row deletion could not be applied.");
163206
163227
  }
@@ -163232,7 +163253,7 @@ function tablesSetRowHeightAdapter(editor, input2, options) {
163232
163253
  applyDirectMutationMeta(tr);
163233
163254
  editor.dispatch(tr);
163234
163255
  clearIndexCache(editor);
163235
- return buildTableSuccess(table2.address);
163256
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163236
163257
  } catch {
163237
163258
  return toTableFailure("INVALID_TARGET", "Row height update could not be applied.");
163238
163259
  }
@@ -163280,7 +163301,7 @@ function tablesDistributeRowsAdapter(editor, input2, options) {
163280
163301
  applyDirectMutationMeta(tr);
163281
163302
  editor.dispatch(tr);
163282
163303
  clearIndexCache(editor);
163283
- return buildTableSuccess(address2);
163304
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
163284
163305
  } catch {
163285
163306
  return toTableFailure("INVALID_TARGET", "Row distribution could not be applied.");
163286
163307
  }
@@ -163314,7 +163335,7 @@ function tablesSetRowOptionsAdapter(editor, input2, options) {
163314
163335
  applyDirectMutationMeta(tr);
163315
163336
  editor.dispatch(tr);
163316
163337
  clearIndexCache(editor);
163317
- return buildTableSuccess(table2.address);
163338
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163318
163339
  } catch {
163319
163340
  return toTableFailure("INVALID_TARGET", "Row options update could not be applied.");
163320
163341
  }
@@ -163351,7 +163372,7 @@ function tablesInsertColumnAdapter(editor, input2, options) {
163351
163372
  applyDirectMutationMeta(tr);
163352
163373
  editor.dispatch(tr);
163353
163374
  clearIndexCache(editor);
163354
- return buildTableSuccess(table2.address);
163375
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163355
163376
  } catch {
163356
163377
  return toTableFailure("INVALID_TARGET", "Column insertion could not be applied.");
163357
163378
  }
@@ -163385,7 +163406,7 @@ function tablesDeleteColumnAdapter(editor, input2, options) {
163385
163406
  applyDirectMutationMeta(tr);
163386
163407
  editor.dispatch(tr);
163387
163408
  clearIndexCache(editor);
163388
- return buildTableSuccess(table2.address);
163409
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163389
163410
  } catch {
163390
163411
  return toTableFailure("INVALID_TARGET", "Column deletion could not be applied.");
163391
163412
  }
@@ -163441,7 +163462,7 @@ function tablesSetColumnWidthAdapter(editor, input2, options) {
163441
163462
  applyDirectMutationMeta(tr);
163442
163463
  editor.dispatch(tr);
163443
163464
  clearIndexCache(editor);
163444
- return buildTableSuccess(table2.address);
163465
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163445
163466
  } catch {
163446
163467
  return toTableFailure("INVALID_TARGET", "Column width update could not be applied.");
163447
163468
  }
@@ -163525,7 +163546,7 @@ function tablesDistributeColumnsAdapter(editor, input2, options) {
163525
163546
  applyDirectMutationMeta(tr);
163526
163547
  editor.dispatch(tr);
163527
163548
  clearIndexCache(editor);
163528
- return buildTableSuccess(address2);
163549
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
163529
163550
  } catch {
163530
163551
  return toTableFailure("INVALID_TARGET", "Column distribution could not be applied.");
163531
163552
  }
@@ -163781,7 +163802,7 @@ function tablesInsertCellAdapter(editor, input2, options) {
163781
163802
  applyDirectMutationMeta(tr);
163782
163803
  editor.dispatch(tr);
163783
163804
  clearIndexCache(editor);
163784
- return buildTableSuccess(table2.address);
163805
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163785
163806
  } catch {
163786
163807
  return toTableFailure("INVALID_TARGET", "Cell insertion could not be applied.");
163787
163808
  }
@@ -163862,7 +163883,7 @@ function tablesDeleteCellAdapter(editor, input2, options) {
163862
163883
  applyDirectMutationMeta(tr);
163863
163884
  editor.dispatch(tr);
163864
163885
  clearIndexCache(editor);
163865
- return buildTableSuccess(table2.address);
163886
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163866
163887
  } catch {
163867
163888
  return toTableFailure("INVALID_TARGET", "Cell deletion could not be applied.");
163868
163889
  }
@@ -163921,7 +163942,7 @@ function tablesMergeCellsAdapter(editor, input2, options) {
163921
163942
  applyDirectMutationMeta(tr);
163922
163943
  editor.dispatch(tr);
163923
163944
  clearIndexCache(editor);
163924
- return buildTableSuccess(table2.address);
163945
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163925
163946
  } catch {
163926
163947
  return toTableFailure("INVALID_TARGET", "Cell merge could not be applied.");
163927
163948
  }
@@ -163956,7 +163977,7 @@ function tablesUnmergeCellsAdapter(editor, input2, options) {
163956
163977
  applyDirectMutationMeta(tr);
163957
163978
  editor.dispatch(tr);
163958
163979
  clearIndexCache(editor);
163959
- return buildTableSuccess(table2.address);
163980
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
163960
163981
  } catch {
163961
163982
  return toTableFailure("INVALID_TARGET", "Cell unmerge could not be applied.");
163962
163983
  }
@@ -164040,7 +164061,7 @@ function tablesSplitCellAdapter(editor, input2, options) {
164040
164061
  applyDirectMutationMeta(tr);
164041
164062
  editor.dispatch(tr);
164042
164063
  clearIndexCache(editor);
164043
- return buildTableSuccess(table2.address);
164064
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
164044
164065
  } catch {
164045
164066
  return toTableFailure("INVALID_TARGET", "Cell split could not be applied.");
164046
164067
  }
@@ -164085,7 +164106,7 @@ function tablesSetCellPropertiesAdapter(editor, input2, options) {
164085
164106
  applyDirectMutationMeta(tr);
164086
164107
  editor.dispatch(tr);
164087
164108
  clearIndexCache(editor);
164088
- return buildTableSuccess(table2.address);
164109
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
164089
164110
  } catch {
164090
164111
  return toTableFailure("INVALID_TARGET", "Cell properties update could not be applied.");
164091
164112
  }
@@ -164148,7 +164169,7 @@ function tablesSortAdapter(editor, input2, options) {
164148
164169
  applyDirectMutationMeta(tr);
164149
164170
  editor.dispatch(tr);
164150
164171
  clearIndexCache(editor);
164151
- return buildTableSuccess(address2);
164172
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164152
164173
  } catch {
164153
164174
  return toTableFailure("INVALID_TARGET", "Table sort could not be applied.");
164154
164175
  }
@@ -164173,7 +164194,7 @@ function tablesSetStyleAdapter(editor, input2, options) {
164173
164194
  applyDirectMutationMeta(tr);
164174
164195
  editor.dispatch(tr);
164175
164196
  clearIndexCache(editor);
164176
- return buildTableSuccess(address2);
164197
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164177
164198
  } catch {
164178
164199
  return toTableFailure("INVALID_TARGET", "Table style assignment could not be applied.");
164179
164200
  }
@@ -164196,7 +164217,7 @@ function tablesClearStyleAdapter(editor, input2, options) {
164196
164217
  applyDirectMutationMeta(tr);
164197
164218
  editor.dispatch(tr);
164198
164219
  clearIndexCache(editor);
164199
- return buildTableSuccess(address2);
164220
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164200
164221
  } catch {
164201
164222
  return toTableFailure("INVALID_TARGET", "Table style removal could not be applied.");
164202
164223
  }
@@ -164233,7 +164254,7 @@ function tablesSetStyleOptionAdapter(editor, input2, options) {
164233
164254
  applyDirectMutationMeta(tr);
164234
164255
  editor.dispatch(tr);
164235
164256
  clearIndexCache(editor);
164236
- return buildTableSuccess(address2);
164257
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164237
164258
  } catch {
164238
164259
  return toTableFailure("INVALID_TARGET", "Table style option could not be applied.");
164239
164260
  }
@@ -164289,6 +164310,8 @@ function tablesSetBorderAdapter(editor, input2, options) {
164289
164310
  applyDirectMutationMeta(tr);
164290
164311
  editor.dispatch(tr);
164291
164312
  clearIndexCache(editor);
164313
+ if (resolved.scope === "table")
164314
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, resolved.pos, resolved.address.nodeId, tr));
164292
164315
  return buildTableSuccess(resolved.address);
164293
164316
  } catch {
164294
164317
  return toTableFailure("INVALID_TARGET", "Border update could not be applied.");
@@ -164326,6 +164349,8 @@ function tablesClearBorderAdapter(editor, input2, options) {
164326
164349
  applyDirectMutationMeta(tr);
164327
164350
  editor.dispatch(tr);
164328
164351
  clearIndexCache(editor);
164352
+ if (resolved.scope === "table")
164353
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, resolved.pos, resolved.address.nodeId, tr));
164329
164354
  return buildTableSuccess(resolved.address);
164330
164355
  } catch {
164331
164356
  return toTableFailure("INVALID_TARGET", "Border clear could not be applied.");
@@ -164396,7 +164421,7 @@ function tablesApplyBorderPresetAdapter(editor, input2, options) {
164396
164421
  applyDirectMutationMeta(tr);
164397
164422
  editor.dispatch(tr);
164398
164423
  clearIndexCache(editor);
164399
- return buildTableSuccess(address2);
164424
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164400
164425
  } catch {
164401
164426
  return toTableFailure("INVALID_TARGET", "Border preset could not be applied.");
164402
164427
  }
@@ -164459,6 +164484,8 @@ function tablesSetShadingAdapter(editor, input2, options) {
164459
164484
  applyDirectMutationMeta(tr);
164460
164485
  editor.dispatch(tr);
164461
164486
  clearIndexCache(editor);
164487
+ if (resolved.scope === "table")
164488
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, resolved.pos, resolved.address.nodeId, tr));
164462
164489
  return buildTableSuccess(resolved.address);
164463
164490
  } catch {
164464
164491
  return toTableFailure("INVALID_TARGET", "Shading update could not be applied.");
@@ -164511,6 +164538,8 @@ function tablesClearShadingAdapter(editor, input2, options) {
164511
164538
  applyDirectMutationMeta(tr);
164512
164539
  editor.dispatch(tr);
164513
164540
  clearIndexCache(editor);
164541
+ if (resolved.scope === "table")
164542
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, resolved.pos, resolved.address.nodeId, tr));
164514
164543
  return buildTableSuccess(resolved.address);
164515
164544
  } catch {
164516
164545
  return toTableFailure("INVALID_TARGET", "Shading clear could not be applied.");
@@ -164551,7 +164580,7 @@ function tablesSetTablePaddingAdapter(editor, input2, options) {
164551
164580
  applyDirectMutationMeta(tr);
164552
164581
  editor.dispatch(tr);
164553
164582
  clearIndexCache(editor);
164554
- return buildTableSuccess(address2);
164583
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164555
164584
  } catch {
164556
164585
  return toTableFailure("INVALID_TARGET", "Table padding could not be applied.");
164557
164586
  }
@@ -164597,7 +164626,7 @@ function tablesSetCellPaddingAdapter(editor, input2, options) {
164597
164626
  applyDirectMutationMeta(tr);
164598
164627
  editor.dispatch(tr);
164599
164628
  clearIndexCache(editor);
164600
- return buildTableSuccess(table2.address);
164629
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, table2.candidate.pos, table2.address.nodeId, tr));
164601
164630
  } catch {
164602
164631
  return toTableFailure("INVALID_TARGET", "Cell padding could not be applied.");
164603
164632
  }
@@ -164623,7 +164652,7 @@ function tablesSetCellSpacingAdapter(editor, input2, options) {
164623
164652
  applyDirectMutationMeta(tr);
164624
164653
  editor.dispatch(tr);
164625
164654
  clearIndexCache(editor);
164626
- return buildTableSuccess(address2);
164655
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164627
164656
  } catch {
164628
164657
  return toTableFailure("INVALID_TARGET", "Cell spacing could not be applied.");
164629
164658
  }
@@ -164647,7 +164676,7 @@ function tablesClearCellSpacingAdapter(editor, input2, options) {
164647
164676
  applyDirectMutationMeta(tr);
164648
164677
  editor.dispatch(tr);
164649
164678
  clearIndexCache(editor);
164650
- return buildTableSuccess(address2);
164679
+ return buildTableSuccess(resolvePostMutationTableAddress(editor, candidate.pos, address2.nodeId, tr));
164651
164680
  } catch {
164652
164681
  return toTableFailure("INVALID_TARGET", "Cell spacing removal could not be applied.");
164653
164682
  }
@@ -225079,7 +225108,7 @@ var Node$13 = class Node$14 {
225079
225108
  return false;
225080
225109
  return Boolean(checker(attrs));
225081
225110
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
225082
- var init_src_zd0A71x4_es = __esm(() => {
225111
+ var init_src_B0uLvfdR_es = __esm(() => {
225083
225112
  init_rolldown_runtime_B2q5OVn9_es();
225084
225113
  init_SuperConverter_BcBeadrv_es();
225085
225114
  init_jszip_ChlR43oI_es();
@@ -258178,7 +258207,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
258178
258207
 
258179
258208
  // ../../packages/superdoc/dist/super-editor.es.js
258180
258209
  var init_super_editor_es = __esm(() => {
258181
- init_src_zd0A71x4_es();
258210
+ init_src_B0uLvfdR_es();
258182
258211
  init_SuperConverter_BcBeadrv_es();
258183
258212
  init_jszip_ChlR43oI_es();
258184
258213
  init_xml_js_BtmJ6bNs_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.25",
3
+ "version": "0.3.0-next.26",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,21 +20,21 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
+ "@superdoc/document-api": "0.0.1",
23
24
  "@superdoc/pm-adapter": "0.0.0",
24
25
  "@superdoc/super-editor": "0.0.1",
25
- "superdoc": "1.20.0",
26
- "@superdoc/document-api": "0.0.1"
26
+ "superdoc": "1.20.0"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.25",
34
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.25",
35
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.25",
36
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.25",
37
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.25"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.26",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.26",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.26",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.26",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.26"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",