@superdoc-dev/cli 0.22.1-next.3 → 0.22.1-next.4

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 +41 -9
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -226928,7 +226928,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
226928
226928
  init_remark_gfm_BUJjZJLy_es();
226929
226929
  });
226930
226930
 
226931
- // ../../packages/superdoc/dist/chunks/src-BEQy1VEN.es.js
226931
+ // ../../packages/superdoc/dist/chunks/src-Br-_2EPy.es.js
226932
226932
  function deleteProps(obj, propOrProps) {
226933
226933
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
226934
226934
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -229084,7 +229084,29 @@ function collectSDTNodes(doc$12) {
229084
229084
  });
229085
229085
  return sdtNodes;
229086
229086
  }
229087
- function checkLockViolation(sdtNodes, from$1, to) {
229087
+ function collectPreservedSDTNodes(previousSdtNodes, nextDoc) {
229088
+ const nextNodesById = /* @__PURE__ */ new Map;
229089
+ for (const nextSdt of collectSDTNodes(nextDoc)) {
229090
+ const id2 = nextSdt.node.attrs.id;
229091
+ if (id2 == null)
229092
+ continue;
229093
+ const key2 = String(id2);
229094
+ const matches2 = nextNodesById.get(key2) ?? [];
229095
+ matches2.push(nextSdt.node);
229096
+ nextNodesById.set(key2, matches2);
229097
+ }
229098
+ const preserved = /* @__PURE__ */ new Set;
229099
+ for (const previousSdt of previousSdtNodes) {
229100
+ const id2 = previousSdt.node.attrs.id;
229101
+ if (id2 == null)
229102
+ continue;
229103
+ const matches2 = nextNodesById.get(String(id2));
229104
+ if (matches2?.length === 1 && matches2[0].eq(previousSdt.node))
229105
+ preserved.add(previousSdt);
229106
+ }
229107
+ return preserved;
229108
+ }
229109
+ function checkLockViolation(sdtNodes, from$1, to, preservedSdtNodes) {
229088
229110
  for (const sdt of sdtNodes) {
229089
229111
  if (!(from$1 < sdt.end && to > sdt.pos))
229090
229112
  continue;
@@ -229096,7 +229118,7 @@ function checkLockViolation(sdtNodes, from$1, to) {
229096
229118
  const wouldModifyContent = insideSDT && !containsSDT;
229097
229119
  const isSdtLocked = sdt.lockMode === "sdtLocked" || sdt.lockMode === "sdtContentLocked";
229098
229120
  const isContentLocked = sdt.lockMode === "contentLocked" || sdt.lockMode === "sdtContentLocked";
229099
- if (isSdtLocked && wouldDamageWrapper)
229121
+ if (isSdtLocked && wouldDamageWrapper && !preservedSdtNodes?.has(sdt))
229100
229122
  return {
229101
229123
  blocked: true,
229102
229124
  reason: `Cannot delete SDT wrapper (${sdt.lockMode})`
@@ -229261,10 +229283,11 @@ function createStructuredContentLockPlugin() {
229261
229283
  const sdtNodes = STRUCTURED_CONTENT_LOCK_KEY.getState(state);
229262
229284
  if (sdtNodes.length === 0)
229263
229285
  return true;
229286
+ const preservedSdtNodes = tr.getMeta?.("structuredContentWrapperPreserving") ? collectPreservedSDTNodes(sdtNodes, tr.doc) : undefined;
229264
229287
  for (const step3 of tr.steps) {
229265
229288
  if (step3.from === undefined || step3.to === undefined)
229266
229289
  continue;
229267
- if (checkLockViolation(sdtNodes, step3.from, step3.to).blocked)
229290
+ if (checkLockViolation(sdtNodes, step3.from, step3.to, preservedSdtNodes).blocked)
229268
229291
  return false;
229269
229292
  }
229270
229293
  return true;
@@ -259459,6 +259482,13 @@ function executeSdtMutation(editor, target, options, handler2) {
259459
259482
  return buildMutationFailure("NO_OP", "The mutation had no effect.");
259460
259483
  return buildMutationSuccess(target, updatedRef);
259461
259484
  }
259485
+ function executeSdtWrappingMutation(editor, target, options, handler2) {
259486
+ const documentBefore = editor.state.doc;
259487
+ const result = executeSdtMutation(editor, target, options, handler2);
259488
+ if (!options?.dryRun && result.success && editor.state.doc === documentBefore)
259489
+ return buildMutationFailure("NO_OP", "The mutation reported success without changing the document.");
259490
+ return result;
259491
+ }
259462
259492
  function dispatchTransaction$1(editor, tr) {
259463
259493
  if (editor.view?.dispatch) {
259464
259494
  editor.view.dispatch(tr);
@@ -259615,7 +259645,7 @@ function wrapWrapper(editor, input2, options) {
259615
259645
  nodeType: "sdt",
259616
259646
  nodeId: id2
259617
259647
  };
259618
- return executeSdtMutation(editor, input2.target, options, () => {
259648
+ return executeSdtWrappingMutation(editor, input2.target, options, () => {
259619
259649
  const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
259620
259650
  const nodeTypeName = input2.kind === "block" ? SDT_BLOCK_NAME : "structuredContent";
259621
259651
  const nodeType = editor.schema.nodes[nodeTypeName];
@@ -259632,6 +259662,7 @@ function wrapWrapper(editor, input2, options) {
259632
259662
  }, resolved.node);
259633
259663
  const { tr } = editor.state;
259634
259664
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, wrapperNode);
259665
+ tr.setMeta(STRUCTURED_CONTENT_WRAPPER_PRESERVING_META, true);
259635
259666
  dispatchTransaction$1(editor, tr);
259636
259667
  return wrapperTarget;
259637
259668
  });
@@ -260514,7 +260545,7 @@ function repeatingSectionSetAllowInsertDeleteWrapper(editor, input2, options) {
260514
260545
  function groupWrapWrapper(editor, input2, options) {
260515
260546
  resolveSdtByTarget(editor.state.doc, input2.target);
260516
260547
  const target = input2.target;
260517
- return executeSdtMutation(editor, target, options, () => {
260548
+ return executeSdtWrappingMutation(editor, target, options, () => {
260518
260549
  const resolved = resolveSdtByTarget(editor.state.doc, input2.target);
260519
260550
  const groupNodeType = editor.schema.nodes[SDT_BLOCK_NAME];
260520
260551
  if (!groupNodeType)
@@ -260527,6 +260558,7 @@ function groupWrapWrapper(editor, input2, options) {
260527
260558
  }, resolved.node);
260528
260559
  const { tr } = editor.state;
260529
260560
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, groupNode);
260561
+ tr.setMeta(STRUCTURED_CONTENT_WRAPPER_PRESERVING_META, true);
260530
260562
  dispatchTransaction$1(editor, tr);
260531
260563
  return {
260532
260564
  kind: "block",
@@ -291421,7 +291453,7 @@ var Node$13 = class Node$14 {
291421
291453
  return !!(node3?.isBlock && node3?.type?.spec?.attrs?.[SD_BLOCK_REV_ATTRIBUTE_NAME]);
291422
291454
  }, nodeNeedsSdBlockId = (node3) => {
291423
291455
  return !node3?.attrs?.[SD_BLOCK_ID_ATTRIBUTE_NAME];
291424
- }, STRUCTURED_CONTENT_LOCK_KEY, SELECT_INLINE_SDT_BEFORE_RUN_START_META = "selectInlineSdtBeforeRunStart", selectInlineSdtBeforeRunStart = () => ({ state, dispatch }) => {
291456
+ }, STRUCTURED_CONTENT_LOCK_KEY, STRUCTURED_CONTENT_WRAPPER_PRESERVING_META = "structuredContentWrapperPreserving", SELECT_INLINE_SDT_BEFORE_RUN_START_META = "selectInlineSdtBeforeRunStart", selectInlineSdtBeforeRunStart = () => ({ state, dispatch }) => {
291425
291457
  const { selection } = state;
291426
291458
  if (!selection.empty)
291427
291459
  return false;
@@ -328494,7 +328526,7 @@ menclose::after {
328494
328526
  return;
328495
328527
  console.log(...args$1);
328496
328528
  }, 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;
328497
- var init_src_BEQy1VEN_es = __esm(() => {
328529
+ var init_src_Br__2EPy_es = __esm(() => {
328498
328530
  init_rolldown_runtime_Bg48TavK_es();
328499
328531
  init_SuperConverter_DuvFI_4h_es();
328500
328532
  init_jszip_C49i9kUs_es();
@@ -372115,7 +372147,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
372115
372147
 
372116
372148
  // ../../packages/superdoc/dist/super-editor.es.js
372117
372149
  var init_super_editor_es = __esm(() => {
372118
- init_src_BEQy1VEN_es();
372150
+ init_src_Br__2EPy_es();
372119
372151
  init_SuperConverter_DuvFI_4h_es();
372120
372152
  init_jszip_C49i9kUs_es();
372121
372153
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.22.1-next.3",
3
+ "version": "0.22.1-next.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,21 +26,21 @@
26
26
  "lib0": "^0.2.114",
27
27
  "typescript": "^5.9.2",
28
28
  "y-protocols": "^1.0.6",
29
- "@superdoc-dev/sdk": "1.21.1",
30
29
  "@superdoc/document-api": "0.1.0-alpha.0",
31
- "superdoc": "1.45.0",
32
- "@superdoc/super-editor": "0.0.1"
30
+ "@superdoc-dev/sdk": "1.21.1",
31
+ "@superdoc/super-editor": "0.0.1",
32
+ "superdoc": "1.45.0"
33
33
  },
34
34
  "module": "src/index.ts",
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
38
  "optionalDependencies": {
39
- "@superdoc-dev/cli-darwin-x64": "0.22.1-next.3",
40
- "@superdoc-dev/cli-darwin-arm64": "0.22.1-next.3",
41
- "@superdoc-dev/cli-linux-x64": "0.22.1-next.3",
42
- "@superdoc-dev/cli-linux-arm64": "0.22.1-next.3",
43
- "@superdoc-dev/cli-windows-x64": "0.22.1-next.3"
39
+ "@superdoc-dev/cli-darwin-arm64": "0.22.1-next.4",
40
+ "@superdoc-dev/cli-darwin-x64": "0.22.1-next.4",
41
+ "@superdoc-dev/cli-linux-x64": "0.22.1-next.4",
42
+ "@superdoc-dev/cli-windows-x64": "0.22.1-next.4",
43
+ "@superdoc-dev/cli-linux-arm64": "0.22.1-next.4"
44
44
  },
45
45
  "scripts": {
46
46
  "predev": "node scripts/ensure-superdoc-build.js",