@superdoc-dev/cli 0.15.0-next.5 → 0.15.0-next.6

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 +158 -87
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -221759,7 +221759,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
221759
221759
  init_remark_gfm_BhnWr3yf_es();
221760
221760
  });
221761
221761
 
221762
- // ../../packages/superdoc/dist/chunks/src-B9A7ox0h.es.js
221762
+ // ../../packages/superdoc/dist/chunks/src-D1Zc7Jgj.es.js
221763
221763
  function deleteProps(obj, propOrProps) {
221764
221764
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
221765
221765
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -223110,12 +223110,80 @@ function findContainingBlockAncestor(element3) {
223110
223110
  }
223111
223111
  return null;
223112
223112
  }
223113
+ function isZeroWidthMarker(node3) {
223114
+ if (node3.type.name === "fieldAnnotation" && node3.attrs?.hidden === true)
223115
+ return true;
223116
+ return ZERO_WIDTH_MARKER_NODE_NAMES.has(node3.type.name);
223117
+ }
223118
+ function findFirstTextPosInNode(node3, nodePos) {
223119
+ if (node3.isText)
223120
+ return nodePos;
223121
+ for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
223122
+ const child = node3.child(index2);
223123
+ const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
223124
+ if (found2 != null)
223125
+ return found2;
223126
+ offset$1 += child.nodeSize;
223127
+ }
223128
+ return null;
223129
+ }
223130
+ function findFirstContentCursorPosInNode(node3, nodePos) {
223131
+ if (isZeroWidthMarker(node3))
223132
+ return null;
223133
+ if (node3.isText || node3.isAtom)
223134
+ return nodePos;
223135
+ if (node3.isTextblock && node3.childCount === 0)
223136
+ return nodePos + 1;
223137
+ for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
223138
+ const child = node3.child(index2);
223139
+ const found2 = findFirstContentCursorPosInNode(child, nodePos + 1 + offset$1);
223140
+ if (found2 != null)
223141
+ return found2;
223142
+ offset$1 += child.nodeSize;
223143
+ }
223144
+ if (node3.isTextblock)
223145
+ return nodePos + 1;
223146
+ return null;
223147
+ }
223148
+ function findLastTextPosInNode(node3, nodePos) {
223149
+ if (node3.isText)
223150
+ return nodePos + (node3.text?.length ?? 0);
223151
+ for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
223152
+ const child = node3.child(index2);
223153
+ offset$1 -= child.nodeSize;
223154
+ const found2 = findLastTextPosInNode(child, nodePos + 1 + offset$1);
223155
+ if (found2 != null)
223156
+ return found2;
223157
+ }
223158
+ return null;
223159
+ }
223160
+ function findLastContentCursorPosInNode(node3, nodePos) {
223161
+ if (isZeroWidthMarker(node3))
223162
+ return null;
223163
+ if (node3.isText)
223164
+ return nodePos + (node3.text?.length ?? 0);
223165
+ if (node3.isAtom)
223166
+ return node3.isInline ? nodePos + node3.nodeSize : nodePos;
223167
+ if (node3.isTextblock && node3.childCount === 0)
223168
+ return nodePos + 1;
223169
+ for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
223170
+ const child = node3.child(index2);
223171
+ offset$1 -= child.nodeSize;
223172
+ const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
223173
+ if (found2 != null)
223174
+ return found2;
223175
+ }
223176
+ if (node3.isTextblock)
223177
+ return nodePos + node3.nodeSize - 1;
223178
+ return null;
223179
+ }
223113
223180
  function collectSDTNodes(doc$12) {
223114
223181
  const sdtNodes = [];
223115
223182
  doc$12.descendants((node3, pos) => {
223116
223183
  if (node3.type.name === "structuredContent" || node3.type.name === "structuredContentBlock")
223117
223184
  sdtNodes.push({
223118
223185
  type: node3.type.name,
223186
+ node: node3,
223119
223187
  lockMode: node3.attrs.lockMode,
223120
223188
  pos,
223121
223189
  end: pos + node3.nodeSize
@@ -223171,6 +223239,15 @@ function isAtBlockSdtWrapperDeletePosition(state, sdt, pos) {
223171
223239
  return false;
223172
223240
  return $pos.before(textblockDepth) === $pos.start(sdtDepth);
223173
223241
  }
223242
+ function selectionCoversSdtContent(sdt, from$1, to) {
223243
+ if (from$1 === sdt.pos + 1 && to === sdt.end - 1)
223244
+ return true;
223245
+ if (sdt.type !== "structuredContentBlock")
223246
+ return false;
223247
+ const contentStart = findFirstContentCursorPosInNode(sdt.node, sdt.pos);
223248
+ const contentEnd = findLastContentCursorPosInNode(sdt.node, sdt.pos);
223249
+ return contentStart != null && contentEnd != null && from$1 === contentStart && to === contentEnd;
223250
+ }
223174
223251
  function createStructuredContentLockPlugin() {
223175
223252
  return new Plugin({
223176
223253
  key: STRUCTURED_CONTENT_LOCK_KEY,
@@ -223198,7 +223275,7 @@ function createStructuredContentLockPlugin() {
223198
223275
  if (sdtNodes.length === 0)
223199
223276
  return false;
223200
223277
  if (from$1 !== to && !(selection instanceof NodeSelection)) {
223201
- const exactContentSDT = sdtNodes.find((s2) => from$1 === s2.pos + 1 && to === s2.end - 1);
223278
+ const exactContentSDT = sdtNodes.find((s2) => selectionCoversSdtContent(s2, from$1, to));
223202
223279
  if (exactContentSDT) {
223203
223280
  const isContentLocked = exactContentSDT.lockMode === "contentLocked" || exactContentSDT.lockMode === "sdtContentLocked";
223204
223281
  const isWrapperDeletable = exactContentSDT.lockMode !== "sdtLocked" && exactContentSDT.lockMode !== "sdtContentLocked";
@@ -224331,80 +224408,70 @@ function shallowEqual$2(a2, b$1) {
224331
224408
  return false;
224332
224409
  return true;
224333
224410
  }
224334
- function isSdtContentFullyLocked(node3) {
224335
- return node3.attrs.lockMode === "sdtContentLocked";
224336
- }
224337
- function findAncestorDepth$2($pos, predicate) {
224411
+ function findAncestorDepth$3($pos, predicate) {
224338
224412
  for (let depth = $pos.depth;depth > 0; depth -= 1)
224339
224413
  if (predicate($pos.node(depth)))
224340
224414
  return depth;
224341
224415
  return null;
224342
224416
  }
224343
- function isZeroWidthMarker(node3) {
224344
- if (node3.type.name === "fieldAnnotation" && node3.attrs?.hidden === true)
224345
- return true;
224346
- return ZERO_WIDTH_MARKER_NODE_NAMES.has(node3.type.name);
224347
- }
224348
- function findFirstTextPosInNode(node3, nodePos) {
224349
- if (node3.isText)
224350
- return nodePos;
224351
- for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
224352
- const child = node3.child(index2);
224353
- const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
224354
- if (found2 != null)
224355
- return found2;
224356
- offset$1 += child.nodeSize;
224417
+ function findSiblingAcrossHiddenMarkers$1(doc$12, pos, direction) {
224418
+ let currentPos = pos;
224419
+ let node3 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
224420
+ while (node3 && isZeroWidthMarker(node3)) {
224421
+ currentPos += direction === "before" ? -node3.nodeSize : node3.nodeSize;
224422
+ node3 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
224357
224423
  }
224358
- return null;
224424
+ return {
224425
+ node: node3,
224426
+ nodePos: direction === "before" && node3 ? currentPos - node3.nodeSize : currentPos
224427
+ };
224359
224428
  }
224360
- function findFirstContentCursorPosInNode(node3, nodePos) {
224361
- if (isZeroWidthMarker(node3))
224429
+ function isAtTextBlockBoundary($from, direction) {
224430
+ const textblockDepth = findAncestorDepth$3($from, (node3) => node3.isTextblock);
224431
+ if (textblockDepth == null)
224362
224432
  return null;
224363
- if (node3.isText || node3.isAtom)
224364
- return nodePos;
224365
- if (node3.isTextblock && node3.childCount === 0)
224366
- return nodePos + 1;
224367
- for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
224368
- const child = node3.child(index2);
224369
- const found2 = findFirstContentCursorPosInNode(child, nodePos + 1 + offset$1);
224370
- if (found2 != null)
224371
- return found2;
224372
- offset$1 += child.nodeSize;
224373
- }
224374
- if (node3.isTextblock)
224375
- return nodePos + 1;
224376
- return null;
224433
+ const textblock = $from.node(textblockDepth);
224434
+ const textblockPos = $from.before(textblockDepth);
224435
+ const boundary = direction === "before" ? findFirstContentCursorPosInNode(textblock, textblockPos) ?? $from.start(textblockDepth) : findLastContentCursorPosInNode(textblock, textblockPos) ?? $from.end(textblockDepth);
224436
+ if ($from.pos !== boundary)
224437
+ return null;
224438
+ return {
224439
+ textblockDepth,
224440
+ textblockPos
224441
+ };
224377
224442
  }
224378
- function findLastTextPosInNode(node3, nodePos) {
224379
- if (node3.isText)
224380
- return nodePos + (node3.text?.length ?? 0);
224381
- for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
224382
- const child = node3.child(index2);
224383
- offset$1 -= child.nodeSize;
224384
- const found2 = findLastTextPosInNode(child, nodePos + 1 + offset$1);
224385
- if (found2 != null)
224386
- return found2;
224387
- }
224388
- return null;
224443
+ function selectAdjacentBlockSdtContent(direction) {
224444
+ return ({ state, dispatch }) => {
224445
+ const { selection } = state;
224446
+ if (!selection.empty)
224447
+ return false;
224448
+ const boundary = isAtTextBlockBoundary(selection.$from, direction);
224449
+ if (!boundary)
224450
+ return false;
224451
+ const siblingBoundaryPos = direction === "before" ? boundary.textblockPos : selection.$from.after(boundary.textblockDepth);
224452
+ const { node: node3, nodePos } = findSiblingAcrossHiddenMarkers$1(state.doc, siblingBoundaryPos, direction);
224453
+ if (node3?.type.name !== "structuredContentBlock")
224454
+ return false;
224455
+ if (node3.content.size === 0)
224456
+ return false;
224457
+ const contentStart = findFirstContentCursorPosInNode(node3, nodePos);
224458
+ const contentEnd = findLastContentCursorPosInNode(node3, nodePos);
224459
+ if (contentStart == null || contentEnd == null)
224460
+ return false;
224461
+ if (contentStart >= contentEnd)
224462
+ return false;
224463
+ if (dispatch)
224464
+ dispatch(state.tr.setSelection(TextSelection.create(state.doc, contentStart, contentEnd)).scrollIntoView());
224465
+ return true;
224466
+ };
224389
224467
  }
224390
- function findLastContentCursorPosInNode(node3, nodePos) {
224391
- if (isZeroWidthMarker(node3))
224392
- return null;
224393
- if (node3.isText)
224394
- return nodePos + (node3.text?.length ?? 0);
224395
- if (node3.isAtom)
224396
- return node3.isInline ? nodePos + node3.nodeSize : nodePos;
224397
- if (node3.isTextblock && node3.childCount === 0)
224398
- return nodePos + 1;
224399
- for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
224400
- const child = node3.child(index2);
224401
- offset$1 -= child.nodeSize;
224402
- const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
224403
- if (found2 != null)
224404
- return found2;
224405
- }
224406
- if (node3.isTextblock)
224407
- return nodePos + node3.nodeSize - 1;
224468
+ function isSdtContentFullyLocked(node3) {
224469
+ return node3.attrs.lockMode === "sdtContentLocked";
224470
+ }
224471
+ function findAncestorDepth$2($pos, predicate) {
224472
+ for (let depth = $pos.depth;depth > 0; depth -= 1)
224473
+ if (predicate($pos.node(depth)))
224474
+ return depth;
224408
224475
  return null;
224409
224476
  }
224410
224477
  function findAncestorDepth$1($pos, predicate) {
@@ -283216,7 +283283,7 @@ var Node$13 = class Node$14 {
283216
283283
  const transaction = view.state.tr.setSelection(selection);
283217
283284
  view.dispatch(transaction);
283218
283285
  }
283219
- }, StructuredContentInlineView, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node3) => {
283286
+ }, StructuredContentInlineView, ZERO_WIDTH_MARKER_NODE_NAMES, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node3) => {
283220
283287
  return !!(node3?.isBlock && node3?.type?.spec?.attrs?.[SD_BLOCK_ID_ATTRIBUTE_NAME]);
283221
283288
  }, nodeAllowsSdBlockRevAttr = (node3) => {
283222
283289
  return !!(node3?.isBlock && node3?.type?.spec?.attrs?.[SD_BLOCK_REV_ATTRIBUTE_NAME]);
@@ -284872,7 +284939,7 @@ var Node$13 = class Node$14 {
284872
284939
  dispatch(tr.scrollIntoView());
284873
284940
  }
284874
284941
  return true;
284875
- }, deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
284942
+ }, selectBlockSdtBeforeTextBlockStart = () => selectAdjacentBlockSdtContent("before"), selectBlockSdtAfterTextBlockEnd = () => selectAdjacentBlockSdtContent("after"), deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
284876
284943
  const { selection } = state;
284877
284944
  if (!selection.empty)
284878
284945
  return false;
@@ -284901,7 +284968,7 @@ var Node$13 = class Node$14 {
284901
284968
  dispatch(tr.setSelection(Selection.near(tr.doc.resolve(selectionPos), -1)).scrollIntoView());
284902
284969
  }
284903
284970
  return true;
284904
- }, ZERO_WIDTH_MARKER_NODE_NAMES, moveIntoBlockSdtBeforeTextBlockStart = () => moveIntoAdjacentBlockSdt("before"), moveIntoBlockSdtAfterTextBlockEnd = () => moveIntoAdjacentBlockSdt("after"), deleteSkipEmptyRun = () => ({ state, dispatch }) => {
284971
+ }, moveIntoBlockSdtBeforeTextBlockStart = () => moveIntoAdjacentBlockSdt("before"), moveIntoBlockSdtAfterTextBlockEnd = () => moveIntoAdjacentBlockSdt("after"), deleteSkipEmptyRun = () => ({ state, dispatch }) => {
284905
284972
  const sel = state.selection;
284906
284973
  if (!sel.empty)
284907
284974
  return false;
@@ -296268,6 +296335,7 @@ var Node$13 = class Node$14 {
296268
296335
  },
296269
296336
  () => commands$1.deleteBlockSdtAtTextBlockStart(),
296270
296337
  () => commands$1.selectInlineSdtBeforeRunStart(),
296338
+ () => commands$1.selectBlockSdtBeforeTextBlockStart(),
296271
296339
  () => commands$1.moveIntoBlockSdtBeforeTextBlockStart(),
296272
296340
  () => commands$1.backspaceEmptyRunParagraph(),
296273
296341
  () => commands$1.backspaceSkipEmptyRun(),
@@ -296286,6 +296354,7 @@ var Node$13 = class Node$14 {
296286
296354
  return editor.commands.first(({ commands: commands$1 }) => [
296287
296355
  () => commands$1.deleteBlockSdtAtTextBlockStart(),
296288
296356
  () => commands$1.selectInlineSdtAfterRunEnd(),
296357
+ () => commands$1.selectBlockSdtAfterTextBlockEnd(),
296289
296358
  () => commands$1.moveIntoBlockSdtAfterTextBlockEnd(),
296290
296359
  () => commands$1.deleteSkipEmptyRun(),
296291
296360
  () => commands$1.deleteAtomAfter(),
@@ -318874,7 +318943,7 @@ menclose::after {
318874
318943
  return;
318875
318944
  console.log(...args$1);
318876
318945
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
318877
- var init_src_B9A7ox0h_es = __esm(() => {
318946
+ var init_src_D1Zc7Jgj_es = __esm(() => {
318878
318947
  init_rolldown_runtime_Bg48TavK_es();
318879
318948
  init_SuperConverter_C6hKp29w_es();
318880
318949
  init_jszip_C49i9kUs_es();
@@ -320632,6 +320701,22 @@ ${err.toString()}`);
320632
320701
  return true;
320633
320702
  }
320634
320703
  };
320704
+ ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
320705
+ "bookmarkStart",
320706
+ "bookmarkEnd",
320707
+ "commentRangeStart",
320708
+ "commentRangeEnd",
320709
+ "commentReference",
320710
+ "permStart",
320711
+ "permEnd",
320712
+ "permStartBlock",
320713
+ "permEndBlock",
320714
+ "tableOfContentsEntry",
320715
+ "indexEntry",
320716
+ "authorityEntry",
320717
+ "passthroughInline",
320718
+ "passthroughBlock"
320719
+ ]);
320635
320720
  ({ findChildren: findChildren$12 } = helpers_exports);
320636
320721
  BlockNodePluginKey = new PluginKey("blockNodePlugin");
320637
320722
  BlockNode = Extension.create({
@@ -321900,22 +321985,6 @@ ${err.toString()}`);
321900
321985
  macBaseKeymap[key2] = pcBaseKeymap[key2];
321901
321986
  typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform && os.platform();
321902
321987
  DELETABLE_INLINE_ATOMS$1 = new Set(["noBreakHyphen"]);
321903
- ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
321904
- "bookmarkStart",
321905
- "bookmarkEnd",
321906
- "commentRangeStart",
321907
- "commentRangeEnd",
321908
- "commentReference",
321909
- "permStart",
321910
- "permEnd",
321911
- "permStartBlock",
321912
- "permEndBlock",
321913
- "tableOfContentsEntry",
321914
- "indexEntry",
321915
- "authorityEntry",
321916
- "passthroughInline",
321917
- "passthroughBlock"
321918
- ]);
321919
321988
  DELETABLE_INLINE_ATOMS = new Set(["noBreakHyphen"]);
321920
321989
  commands_exports = /* @__PURE__ */ __export3({
321921
321990
  SELECT_INLINE_SDT_BEFORE_RUN_START_META: () => SELECT_INLINE_SDT_BEFORE_RUN_START_META,
@@ -321966,6 +322035,8 @@ ${err.toString()}`);
321966
322035
  resetAttributes: () => resetAttributes,
321967
322036
  restoreSelection: () => restoreSelection,
321968
322037
  selectAll: () => selectAll$1,
322038
+ selectBlockSdtAfterTextBlockEnd: () => selectBlockSdtAfterTextBlockEnd,
322039
+ selectBlockSdtBeforeTextBlockStart: () => selectBlockSdtBeforeTextBlockStart,
321969
322040
  selectInlineSdtAfterRunEnd: () => selectInlineSdtAfterRunEnd,
321970
322041
  selectInlineSdtBeforeRunStart: () => selectInlineSdtBeforeRunStart,
321971
322042
  selectNodeBackward: () => selectNodeBackward$1,
@@ -353127,7 +353198,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
353127
353198
 
353128
353199
  // ../../packages/superdoc/dist/super-editor.es.js
353129
353200
  var init_super_editor_es = __esm(() => {
353130
- init_src_B9A7ox0h_es();
353201
+ init_src_D1Zc7Jgj_es();
353131
353202
  init_SuperConverter_C6hKp29w_es();
353132
353203
  init_jszip_C49i9kUs_es();
353133
353204
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.15.0-next.5",
3
+ "version": "0.15.0-next.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,8 +25,8 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/pm-adapter": "0.0.0",
29
28
  "@superdoc/super-editor": "0.0.1",
29
+ "@superdoc/pm-adapter": "0.0.0",
30
30
  "superdoc": "1.37.0"
31
31
  },
32
32
  "module": "src/index.ts",
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-x64": "0.15.0-next.5",
38
- "@superdoc-dev/cli-darwin-arm64": "0.15.0-next.5",
39
- "@superdoc-dev/cli-linux-x64": "0.15.0-next.5",
40
- "@superdoc-dev/cli-linux-arm64": "0.15.0-next.5",
41
- "@superdoc-dev/cli-windows-x64": "0.15.0-next.5"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.15.0-next.6",
38
+ "@superdoc-dev/cli-darwin-x64": "0.15.0-next.6",
39
+ "@superdoc-dev/cli-linux-x64": "0.15.0-next.6",
40
+ "@superdoc-dev/cli-linux-arm64": "0.15.0-next.6",
41
+ "@superdoc-dev/cli-windows-x64": "0.15.0-next.6"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",