@superdoc-dev/cli 0.2.0-next.88 → 0.2.0-next.89

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 +128 -13
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -121745,9 +121745,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
121745
121745
  init_remark_gfm_z_sDF4ss_es();
121746
121746
  });
121747
121747
 
121748
- // ../../packages/superdoc/dist/chunks/src-BneEE4-O.es.js
121749
- var exports_src_BneEE4_O_es = {};
121750
- __export(exports_src_BneEE4_O_es, {
121748
+ // ../../packages/superdoc/dist/chunks/src-CKjtLfFG.es.js
121749
+ var exports_src_CKjtLfFG_es = {};
121750
+ __export(exports_src_CKjtLfFG_es, {
121751
121751
  zt: () => defineMark,
121752
121752
  z: () => cM,
121753
121753
  yt: () => removeAwarenessStates,
@@ -127544,6 +127544,20 @@ function skipTab(dir) {
127544
127544
  return true;
127545
127545
  };
127546
127546
  }
127547
+ function tableSeparatorNeeds$1(doc$2, pos) {
127548
+ const $pos = doc$2.resolve(pos);
127549
+ if ($pos.depth !== 0)
127550
+ return {
127551
+ before: false,
127552
+ after: false
127553
+ };
127554
+ const indexAfter = $pos.index(0);
127555
+ const nodeAfter = indexAfter < doc$2.childCount ? doc$2.child(indexAfter) : null;
127556
+ return {
127557
+ before: (indexAfter > 0 ? doc$2.child(indexAfter - 1) : null)?.type.name === "table",
127558
+ after: !nodeAfter || nodeAfter.type.name === "table"
127559
+ };
127560
+ }
127547
127561
  function isVisuallyEmptyParagraph(node3) {
127548
127562
  if (!node3 || node3.type.name !== "paragraph")
127549
127563
  return false;
@@ -133017,6 +133031,11 @@ function editorHasDom(editor) {
133017
133031
  const opts = editor.options;
133018
133032
  return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
133019
133033
  }
133034
+ function ensureTableSeparators(jsonNodes) {
133035
+ for (let i$1 = jsonNodes.length - 2;i$1 >= 0; i$1--)
133036
+ if (jsonNodes[i$1].type === "table" && jsonNodes[i$1 + 1].type === "table")
133037
+ jsonNodes.splice(i$1 + 1, 0, { type: "paragraph" });
133038
+ }
133020
133039
  function normalizeWriteLocator(request) {
133021
133040
  if (request.kind === "insert") {
133022
133041
  const hasBlockId = request.blockId !== undefined;
@@ -133478,6 +133497,22 @@ function insertStructuredWrapper(editor, input2, options) {
133478
133497
  }
133479
133498
  const jsonNodes = [];
133480
133499
  fragment.forEach((node3) => jsonNodes.push(node3.toJSON()));
133500
+ ensureTableSeparators(jsonNodes);
133501
+ if (from$12 === to) {
133502
+ const $pos = editor.state.doc.resolve(from$12);
133503
+ const parent = $pos.parent;
133504
+ if (parent.isTextblock && !parent.childCount) {
133505
+ const grandparent = $pos.node($pos.depth - 1);
133506
+ const idx = $pos.index($pos.depth - 1);
133507
+ const prevIsTable = idx > 0 && grandparent.child(idx - 1).type.name === "table";
133508
+ const nextIsTable = idx + 1 < grandparent.childCount && grandparent.child(idx + 1).type.name === "table";
133509
+ const atEnd = idx + 1 >= grandparent.childCount;
133510
+ if (jsonNodes[0]?.type === "table" && prevIsTable)
133511
+ jsonNodes.unshift({ type: "paragraph" });
133512
+ if (jsonNodes[jsonNodes.length - 1]?.type === "table" && (nextIsTable || atEnd))
133513
+ jsonNodes.push({ type: "paragraph" });
133514
+ }
133515
+ }
133481
133516
  const ok3 = Boolean(editor.commands.insertContentAt({
133482
133517
  from: from$12,
133483
133518
  to
@@ -163762,6 +163797,20 @@ function insertRowAtIndex({ tr, tablePos, tableNode, sourceRowIndex, insertIndex
163762
163797
  }
163763
163798
  return true;
163764
163799
  }
163800
+ function tableSeparatorNeeds(doc$2, pos) {
163801
+ const $pos = doc$2.resolve(pos);
163802
+ if ($pos.depth !== 0)
163803
+ return {
163804
+ before: false,
163805
+ after: false
163806
+ };
163807
+ const indexAfter = $pos.index(0);
163808
+ const nodeAfter = indexAfter < doc$2.childCount ? doc$2.child(indexAfter) : null;
163809
+ return {
163810
+ before: (indexAfter > 0 ? doc$2.child(indexAfter - 1) : null)?.type.name === "table",
163811
+ after: !nodeAfter || nodeAfter.type.name === "table"
163812
+ };
163813
+ }
163765
163814
  function getCellType({ node: node3, state }) {
163766
163815
  return tableNodeTypes(state.schema)[node3.type.spec.tableRole];
163767
163816
  }
@@ -176507,7 +176556,25 @@ var Node$13 = class Node$14 {
176507
176556
  }
176508
176557
  const tableAttrs = sdBlockId ? { sdBlockId } : undefined;
176509
176558
  const tableNode = tableType.createChecked(tableAttrs, rowNodes);
176510
- const tr = state.tr.insert(pos, tableNode);
176559
+ const sep = tableSeparatorNeeds$1(state.doc, pos);
176560
+ let tr;
176561
+ if (sep.before || sep.after) {
176562
+ const makeSep = () => state.schema.nodes.paragraph.createAndFill();
176563
+ const nodes = [];
176564
+ if (sep.before) {
176565
+ const s2 = makeSep();
176566
+ if (s2)
176567
+ nodes.push(s2);
176568
+ }
176569
+ nodes.push(tableNode);
176570
+ if (sep.after) {
176571
+ const s2 = makeSep();
176572
+ if (s2)
176573
+ nodes.push(s2);
176574
+ }
176575
+ tr = state.tr.insert(pos, Fragment.from(nodes));
176576
+ } else
176577
+ tr = state.tr.insert(pos, tableNode);
176511
176578
  if (!dispatch)
176512
176579
  return true;
176513
176580
  tr.setMeta("inputType", "programmatic");
@@ -198729,7 +198796,7 @@ var Node$13 = class Node$14 {
198729
198796
  trackedChanges: context.trackedChanges ?? []
198730
198797
  });
198731
198798
  }, _hoisted_1$6, _hoisted_2$2, _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, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_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, POPOVER_VERTICAL_OFFSET_PX = 15, 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;
198732
- var init_src_BneEE4_O_es = __esm(() => {
198799
+ var init_src_CKjtLfFG_es = __esm(() => {
198733
198800
  init_rolldown_runtime_B2q5OVn9_es();
198734
198801
  init_SuperConverter_CHHvo5ta_es();
198735
198802
  init_jszip_ChlR43oI_es();
@@ -222649,7 +222716,30 @@ function print() { __p += __j.call(arguments, '') }
222649
222716
  };
222650
222717
  const tableNode = tableType.createChecked(tableAttrs, rowNodes);
222651
222718
  if (dispatch) {
222652
- tr.insert(pos, tableNode);
222719
+ const sep = tableSeparatorNeeds(state.doc, pos);
222720
+ const makeSep = () => {
222721
+ const attrs = {
222722
+ sdBlockId: v4_default(),
222723
+ paraId: genParaId()
222724
+ };
222725
+ return state.schema.nodes.paragraph.createAndFill(attrs);
222726
+ };
222727
+ if (sep.before || sep.after) {
222728
+ const nodes = [];
222729
+ if (sep.before) {
222730
+ const s2 = makeSep();
222731
+ if (s2)
222732
+ nodes.push(s2);
222733
+ }
222734
+ nodes.push(tableNode);
222735
+ if (sep.after) {
222736
+ const s2 = makeSep();
222737
+ if (s2)
222738
+ nodes.push(s2);
222739
+ }
222740
+ tr.insert(pos, Fragment.from(nodes));
222741
+ } else
222742
+ tr.insert(pos, tableNode);
222653
222743
  tr.setMeta("inputType", "programmatic");
222654
222744
  if (tracked === true)
222655
222745
  tr.setMeta("forceTrackChanges", true);
@@ -230439,8 +230529,8 @@ function print() { __p += __j.call(arguments, '') }
230439
230529
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
230440
230530
  };
230441
230531
  stubFalse_default = stubFalse;
230442
- freeExports$2 = typeof exports_src_BneEE4_O_es == "object" && exports_src_BneEE4_O_es && !exports_src_BneEE4_O_es.nodeType && exports_src_BneEE4_O_es;
230443
- freeModule$2 = freeExports$2 && typeof module_src_BneEE4_O_es == "object" && module_src_BneEE4_O_es && !module_src_BneEE4_O_es.nodeType && module_src_BneEE4_O_es;
230532
+ freeExports$2 = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230533
+ freeModule$2 = freeExports$2 && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230444
230534
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
230445
230535
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
230446
230536
  typedArrayTags = {};
@@ -230448,8 +230538,8 @@ function print() { __p += __j.call(arguments, '') }
230448
230538
  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;
230449
230539
  _baseIsTypedArray_default = baseIsTypedArray;
230450
230540
  _baseUnary_default = baseUnary;
230451
- freeExports$1 = typeof exports_src_BneEE4_O_es == "object" && exports_src_BneEE4_O_es && !exports_src_BneEE4_O_es.nodeType && exports_src_BneEE4_O_es;
230452
- freeModule$1 = freeExports$1 && typeof module_src_BneEE4_O_es == "object" && module_src_BneEE4_O_es && !module_src_BneEE4_O_es.nodeType && module_src_BneEE4_O_es;
230541
+ freeExports$1 = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230542
+ freeModule$1 = freeExports$1 && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230453
230543
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
230454
230544
  _nodeUtil_default = function() {
230455
230545
  try {
@@ -230554,8 +230644,8 @@ function print() { __p += __j.call(arguments, '') }
230554
230644
  Stack.prototype.has = _stackHas_default;
230555
230645
  Stack.prototype.set = _stackSet_default;
230556
230646
  _Stack_default = Stack;
230557
- freeExports = typeof exports_src_BneEE4_O_es == "object" && exports_src_BneEE4_O_es && !exports_src_BneEE4_O_es.nodeType && exports_src_BneEE4_O_es;
230558
- freeModule = freeExports && typeof module_src_BneEE4_O_es == "object" && module_src_BneEE4_O_es && !module_src_BneEE4_O_es.nodeType && module_src_BneEE4_O_es;
230647
+ freeExports = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230648
+ freeModule = freeExports && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230559
230649
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
230560
230650
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
230561
230651
  _cloneBuffer_default = cloneBuffer;
@@ -238635,7 +238725,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
238635
238725
 
238636
238726
  // ../../packages/superdoc/dist/super-editor.es.js
238637
238727
  var init_super_editor_es = __esm(() => {
238638
- init_src_BneEE4_O_es();
238728
+ init_src_CKjtLfFG_es();
238639
238729
  init_SuperConverter_CHHvo5ta_es();
238640
238730
  init_jszip_ChlR43oI_es();
238641
238731
  init_xml_js_DLE8mr0n_es();
@@ -303601,6 +303691,13 @@ function editorHasDom2(editor) {
303601
303691
  const opts = editor.options;
303602
303692
  return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
303603
303693
  }
303694
+ function ensureTableSeparators2(jsonNodes) {
303695
+ for (let i4 = jsonNodes.length - 2;i4 >= 0; i4--) {
303696
+ if (jsonNodes[i4].type === "table" && jsonNodes[i4 + 1].type === "table") {
303697
+ jsonNodes.splice(i4 + 1, 0, { type: "paragraph" });
303698
+ }
303699
+ }
303700
+ }
303604
303701
  function normalizeWriteLocator2(request) {
303605
303702
  if (request.kind === "insert") {
303606
303703
  const hasBlockId = request.blockId !== undefined;
@@ -303995,6 +304092,24 @@ function insertStructuredWrapper2(editor, input2, options) {
303995
304092
  }
303996
304093
  const jsonNodes = [];
303997
304094
  fragment.forEach((node4) => jsonNodes.push(node4.toJSON()));
304095
+ ensureTableSeparators2(jsonNodes);
304096
+ if (from4 === to) {
304097
+ const $pos = editor.state.doc.resolve(from4);
304098
+ const parent = $pos.parent;
304099
+ if (parent.isTextblock && !parent.childCount) {
304100
+ const grandparent = $pos.node($pos.depth - 1);
304101
+ const idx = $pos.index($pos.depth - 1);
304102
+ const prevIsTable = idx > 0 && grandparent.child(idx - 1).type.name === "table";
304103
+ const nextIsTable = idx + 1 < grandparent.childCount && grandparent.child(idx + 1).type.name === "table";
304104
+ const atEnd = idx + 1 >= grandparent.childCount;
304105
+ if (jsonNodes[0]?.type === "table" && prevIsTable) {
304106
+ jsonNodes.unshift({ type: "paragraph" });
304107
+ }
304108
+ if (jsonNodes[jsonNodes.length - 1]?.type === "table" && (nextIsTable || atEnd)) {
304109
+ jsonNodes.push({ type: "paragraph" });
304110
+ }
304111
+ }
304112
+ }
303998
304113
  const ok5 = Boolean(editor.commands.insertContentAt({ from: from4, to }, jsonNodes));
303999
304114
  if (!ok5) {
304000
304115
  insertFailure = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.88",
3
+ "version": "0.2.0-next.89",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -22,19 +22,19 @@
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
24
  "@superdoc/pm-adapter": "0.0.0",
25
- "@superdoc/super-editor": "0.0.1",
26
- "superdoc": "1.17.0"
25
+ "superdoc": "1.17.0",
26
+ "@superdoc/super-editor": "0.0.1"
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.2.0-next.88",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.88",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.88",
36
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.88",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.88"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.89",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.89",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.89",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.89",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.89"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",