@superdoc-dev/cli 0.16.0-next.34 → 0.16.0-next.35

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 +266 -166
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -59533,90 +59533,70 @@ Actual: ` + parser.attribValue);
59533
59533
  });
59534
59534
  });
59535
59535
 
59536
- // ../../packages/superdoc/dist/chunks/uuid-qzgm05fK.es.js
59537
- function rng() {
59538
- if (!getRandomValues3) {
59539
- getRandomValues3 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
59540
- if (!getRandomValues3)
59541
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
59542
- }
59543
- return getRandomValues3(rnds8);
59544
- }
59536
+ // ../../packages/superdoc/dist/chunks/uuid-B2wVPhPi.es.js
59545
59537
  function validate(uuid) {
59546
59538
  return typeof uuid === "string" && regex_default.test(uuid);
59547
59539
  }
59548
- function unsafeStringify(arr, offset = 0) {
59549
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
59550
- }
59551
59540
  function parse(uuid) {
59552
59541
  if (!validate_default(uuid))
59553
59542
  throw TypeError("Invalid UUID");
59554
59543
  let v;
59555
- const arr = new Uint8Array(16);
59556
- arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
59557
- arr[1] = v >>> 16 & 255;
59558
- arr[2] = v >>> 8 & 255;
59559
- arr[3] = v & 255;
59560
- arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
59561
- arr[5] = v & 255;
59562
- arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
59563
- arr[7] = v & 255;
59564
- arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
59565
- arr[9] = v & 255;
59566
- arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
59567
- arr[11] = v / 4294967296 & 255;
59568
- arr[12] = v >>> 24 & 255;
59569
- arr[13] = v >>> 16 & 255;
59570
- arr[14] = v >>> 8 & 255;
59571
- arr[15] = v & 255;
59572
- return arr;
59544
+ return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
59545
+ }
59546
+ function unsafeStringify(arr, offset = 0) {
59547
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
59548
+ }
59549
+ function rng() {
59550
+ if (!getRandomValues3) {
59551
+ if (typeof crypto === "undefined" || !crypto.getRandomValues)
59552
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
59553
+ getRandomValues3 = crypto.getRandomValues.bind(crypto);
59554
+ }
59555
+ return getRandomValues3(rnds8);
59573
59556
  }
59574
59557
  function stringToBytes(str) {
59575
59558
  str = unescape(encodeURIComponent(str));
59576
- const bytes = [];
59559
+ const bytes = new Uint8Array(str.length);
59577
59560
  for (let i2 = 0;i2 < str.length; ++i2)
59578
- bytes.push(str.charCodeAt(i2));
59561
+ bytes[i2] = str.charCodeAt(i2);
59579
59562
  return bytes;
59580
59563
  }
59581
- function v35(name, version3, hashfunc) {
59582
- function generateUUID(value, namespace, buf, offset) {
59583
- var _namespace;
59584
- if (typeof value === "string")
59585
- value = stringToBytes(value);
59586
- if (typeof namespace === "string")
59587
- namespace = parse_default(namespace);
59588
- if (((_namespace = namespace) === null || _namespace === undefined ? undefined : _namespace.length) !== 16)
59589
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
59590
- let bytes = new Uint8Array(16 + value.length);
59591
- bytes.set(namespace);
59592
- bytes.set(value, namespace.length);
59593
- bytes = hashfunc(bytes);
59594
- bytes[6] = bytes[6] & 15 | version3;
59595
- bytes[8] = bytes[8] & 63 | 128;
59596
- if (buf) {
59597
- offset = offset || 0;
59598
- for (let i2 = 0;i2 < 16; ++i2)
59599
- buf[offset + i2] = bytes[i2];
59600
- return buf;
59601
- }
59602
- return unsafeStringify(bytes);
59564
+ function v35(version3, hash, value, namespace, buf, offset) {
59565
+ const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
59566
+ const namespaceBytes = typeof namespace === "string" ? parse_default(namespace) : namespace;
59567
+ if (typeof namespace === "string")
59568
+ namespace = parse_default(namespace);
59569
+ if (namespace?.length !== 16)
59570
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
59571
+ let bytes = new Uint8Array(16 + valueBytes.length);
59572
+ bytes.set(namespaceBytes);
59573
+ bytes.set(valueBytes, namespaceBytes.length);
59574
+ bytes = hash(bytes);
59575
+ bytes[6] = bytes[6] & 15 | version3;
59576
+ bytes[8] = bytes[8] & 63 | 128;
59577
+ if (buf) {
59578
+ offset = offset || 0;
59579
+ if (offset < 0 || offset + 16 > buf.length)
59580
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59581
+ for (let i2 = 0;i2 < 16; ++i2)
59582
+ buf[offset + i2] = bytes[i2];
59583
+ return buf;
59603
59584
  }
59604
- try {
59605
- generateUUID.name = name;
59606
- } catch (err) {}
59607
- generateUUID.DNS = DNS;
59608
- generateUUID.URL = URL2;
59609
- return generateUUID;
59585
+ return unsafeStringify(bytes);
59610
59586
  }
59611
59587
  function v4(options, buf, offset) {
59612
59588
  if (native_default.randomUUID && !buf && !options)
59613
59589
  return native_default.randomUUID();
59614
59590
  options = options || {};
59615
- const rnds = options.random || (options.rng || rng)();
59591
+ const rnds = options.random ?? options.rng?.() ?? rng();
59592
+ if (rnds.length < 16)
59593
+ throw new Error("Random bytes length must be >= 16");
59616
59594
  rnds[6] = rnds[6] & 15 | 64;
59617
59595
  rnds[8] = rnds[8] & 63 | 128;
59618
59596
  if (buf) {
59619
59597
  offset = offset || 0;
59598
+ if (offset < 0 || offset + 16 > buf.length)
59599
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59620
59600
  for (let i2 = 0;i2 < 16; ++i2)
59621
59601
  buf[offset + i2] = rnds[i2];
59622
59602
  return buf;
@@ -59652,14 +59632,10 @@ function sha1(bytes) {
59652
59632
  271733878,
59653
59633
  3285377520
59654
59634
  ];
59655
- if (typeof bytes === "string") {
59656
- const msg = unescape(encodeURIComponent(bytes));
59657
- bytes = [];
59658
- for (let i2 = 0;i2 < msg.length; ++i2)
59659
- bytes.push(msg.charCodeAt(i2));
59660
- } else if (!Array.isArray(bytes))
59661
- bytes = Array.prototype.slice.call(bytes);
59662
- bytes.push(128);
59635
+ const newBytes = new Uint8Array(bytes.length + 1);
59636
+ newBytes.set(bytes);
59637
+ newBytes[bytes.length] = 128;
59638
+ bytes = newBytes;
59663
59639
  const l = bytes.length / 4 + 2;
59664
59640
  const N = Math.ceil(l / 16);
59665
59641
  const M = new Array(N);
@@ -59698,41 +59674,26 @@ function sha1(bytes) {
59698
59674
  H[3] = H[3] + d >>> 0;
59699
59675
  H[4] = H[4] + e >>> 0;
59700
59676
  }
59701
- return [
59702
- H[0] >> 24 & 255,
59703
- H[0] >> 16 & 255,
59704
- H[0] >> 8 & 255,
59705
- H[0] & 255,
59706
- H[1] >> 24 & 255,
59707
- H[1] >> 16 & 255,
59708
- H[1] >> 8 & 255,
59709
- H[1] & 255,
59710
- H[2] >> 24 & 255,
59711
- H[2] >> 16 & 255,
59712
- H[2] >> 8 & 255,
59713
- H[2] & 255,
59714
- H[3] >> 24 & 255,
59715
- H[3] >> 16 & 255,
59716
- H[3] >> 8 & 255,
59717
- H[3] & 255,
59718
- H[4] >> 24 & 255,
59719
- H[4] >> 16 & 255,
59720
- H[4] >> 8 & 255,
59721
- H[4] & 255
59722
- ];
59677
+ return Uint8Array.of(H[0] >> 24, H[0] >> 16, H[0] >> 8, H[0], H[1] >> 24, H[1] >> 16, H[1] >> 8, H[1], H[2] >> 24, H[2] >> 16, H[2] >> 8, H[2], H[3] >> 24, H[3] >> 16, H[3] >> 8, H[3], H[4] >> 24, H[4] >> 16, H[4] >> 8, H[4]);
59723
59678
  }
59724
- var getRandomValues3, rnds8, regex_default, validate_default, byteToHex, parse_default, DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8", native_default, v4_default, v5_default;
59725
- var init_uuid_qzgm05fK_es = __esm(() => {
59726
- rnds8 = new Uint8Array(16);
59727
- regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
59679
+ function v5(value, namespace, buf, offset) {
59680
+ return v35(80, sha1_default, value, namespace, buf, offset);
59681
+ }
59682
+ var regex_default, validate_default, parse_default, byteToHex, getRandomValues3, rnds8, DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8", native_default, v4_default, sha1_default, v5_default;
59683
+ var init_uuid_B2wVPhPi_es = __esm(() => {
59684
+ regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
59728
59685
  validate_default = validate;
59686
+ parse_default = parse;
59729
59687
  byteToHex = [];
59730
59688
  for (let i2 = 0;i2 < 256; ++i2)
59731
59689
  byteToHex.push((i2 + 256).toString(16).slice(1));
59732
- parse_default = parse;
59690
+ rnds8 = new Uint8Array(16);
59733
59691
  native_default = { randomUUID: typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
59734
59692
  v4_default = v4;
59735
- v5_default = v35("v5", 80, sha1);
59693
+ sha1_default = sha1;
59694
+ v5.DNS = DNS;
59695
+ v5.URL = URL2;
59696
+ v5_default = v5;
59736
59697
  });
59737
59698
 
59738
59699
  // ../../packages/superdoc/dist/chunks/constants-D9qj59G2.es.js
@@ -68366,7 +68327,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68366
68327
  emptyOptions2 = {};
68367
68328
  });
68368
68329
 
68369
- // ../../packages/superdoc/dist/chunks/SuperConverter-DOoAJ6Zk.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CJi2bUhE.es.js
68370
68331
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68371
68332
  const fieldValue = extension$1.config[field];
68372
68333
  if (typeof fieldValue === "function")
@@ -77490,9 +77451,9 @@ function decode$66(params3) {
77490
77451
  });
77491
77452
  if (params3.isFinalDoc)
77492
77453
  return null;
77493
- const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
77494
- if (textNode)
77495
- textNode.name = "w:delText";
77454
+ (translatedTextNode.elements || []).filter((n) => n.name === "w:t").forEach((n) => {
77455
+ n.name = "w:delText";
77456
+ });
77496
77457
  return {
77497
77458
  name: "w:del",
77498
77459
  attributes: {
@@ -98593,14 +98554,37 @@ function getTextNodeForExport(text$2, marks, params3) {
98593
98554
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
98594
98555
  partPath: resolveExportPartPath(params3)
98595
98556
  });
98596
- textNodes.push({
98597
- name: "w:t",
98598
- elements: [{
98599
- text: text$2,
98600
- type: "text"
98601
- }],
98602
- attributes: nodeAttrs
98603
- });
98557
+ const textValue = typeof text$2 === "string" ? text$2 : "";
98558
+ const normalizedText = textValue.includes("\r") ? textValue.replace(/\r\n?/g, `
98559
+ `) : textValue;
98560
+ if (normalizedText.includes(`
98561
+ `)) {
98562
+ const segments = normalizedText.split(`
98563
+ `);
98564
+ segments.forEach((segment, index2) => {
98565
+ if (segment.length > 0) {
98566
+ const segmentNeedsSpace = /^\s|\s$/.test(segment);
98567
+ textNodes.push({
98568
+ name: "w:t",
98569
+ elements: [{
98570
+ text: segment,
98571
+ type: "text"
98572
+ }],
98573
+ attributes: segmentNeedsSpace ? { "xml:space": "preserve" } : null
98574
+ });
98575
+ }
98576
+ if (index2 < segments.length - 1)
98577
+ textNodes.push({ name: "w:br" });
98578
+ });
98579
+ } else
98580
+ textNodes.push({
98581
+ name: "w:t",
98582
+ elements: [{
98583
+ text: normalizedText,
98584
+ type: "text"
98585
+ }],
98586
+ attributes: nodeAttrs
98587
+ });
98604
98588
  if (params3?.editor?.extensionService?.extensions) {
98605
98589
  const customMarks = params3.editor.extensionService.extensions.filter((extension$1) => extension$1.isExternal === true);
98606
98590
  normalizedMarks.forEach((mark) => {
@@ -107788,6 +107772,9 @@ function hasTrackDeleteMark(node3) {
107788
107772
  function shouldSkipTextNode(node3, options) {
107789
107773
  return isVisibleTextModel(options) && hasTrackDeleteMark(node3);
107790
107774
  }
107775
+ function shouldSkipLeafNode(node3, options) {
107776
+ return isVisibleTextModel(options) && hasTrackDeleteMark(node3);
107777
+ }
107791
107778
  function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
107792
107779
  if (segmentLength <= 1)
107793
107780
  return targetOffset <= segmentStart ? docFrom : docTo;
@@ -107819,7 +107806,13 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos, options) {
107819
107806
  return;
107820
107807
  }
107821
107808
  if (node3.isLeaf) {
107822
- if (pmPos >= docPos + node3.nodeSize)
107809
+ const endPos = docPos + node3.nodeSize;
107810
+ if (shouldSkipLeafNode(node3, options)) {
107811
+ if (pmPos < endPos)
107812
+ done = true;
107813
+ return;
107814
+ }
107815
+ if (pmPos >= endPos)
107823
107816
  offset += 1;
107824
107817
  else
107825
107818
  done = true;
@@ -107860,6 +107853,8 @@ function computeTextContentLength(blockNode, options) {
107860
107853
  return;
107861
107854
  }
107862
107855
  if (node3.isLeaf) {
107856
+ if (shouldSkipLeafNode(node3, options))
107857
+ return;
107863
107858
  length3 += 1;
107864
107859
  return;
107865
107860
  }
@@ -107919,6 +107914,8 @@ function resolveTextRangeInBlock(blockNode, blockPos, range, options) {
107919
107914
  return;
107920
107915
  }
107921
107916
  if (node3.isLeaf) {
107917
+ if (shouldSkipLeafNode(node3, options))
107918
+ return;
107922
107919
  advanceSegment(1, docPos, docPos + node3.nodeSize);
107923
107920
  return;
107924
107921
  }
@@ -107950,7 +107947,10 @@ function textContentInBlock(blockNode, options) {
107950
107947
  return;
107951
107948
  }
107952
107949
  if (node3.isLeaf) {
107953
- text$2 += "";
107950
+ if (shouldSkipLeafNode(node3, options))
107951
+ return;
107952
+ const leafText = node3.type?.spec?.leafText;
107953
+ text$2 += typeof leafText === "function" ? leafText(node3) : "";
107954
107954
  return;
107955
107955
  }
107956
107956
  let isFirstChild$1 = true;
@@ -107975,19 +107975,31 @@ function textContentInBlock(blockNode, options) {
107975
107975
  return text$2;
107976
107976
  }
107977
107977
  function buildTextWithTabs(schema, text$2, marks, opts = {}) {
107978
- if (!text$2.includes("\t"))
107979
- return schema.text(text$2, marks);
107980
- const tabNodeType = schema.nodes?.tab;
107981
- if (!tabNodeType || opts.parentAllowsTab === false)
107982
- return schema.text(text$2, marks);
107983
- const tabMarks = marks ?? null;
107984
- const parts = text$2.split("\t");
107978
+ const normalized = text$2.includes("\r") ? text$2.replace(/\r\n?/g, `
107979
+ `) : text$2;
107980
+ const hasTab = normalized.includes("\t");
107981
+ const hasNewline = normalized.includes(`
107982
+ `);
107983
+ if (!hasTab && !hasNewline)
107984
+ return schema.text(normalized, marks);
107985
+ const tabNodeType = hasTab && opts.parentAllowsTab !== false ? schema.nodes?.tab : undefined;
107986
+ const lineBreakNodeType = hasNewline && opts.parentAllowsLineBreak !== false ? schema.nodes?.lineBreak : undefined;
107987
+ if (!tabNodeType && !lineBreakNodeType)
107988
+ return schema.text(normalized, marks);
107989
+ const tabMarks = marks ?? undefined;
107990
+ const splitPattern = [tabNodeType ? "\\t" : null, lineBreakNodeType ? "\\n" : null].filter(Boolean).join("|");
107991
+ const parts = normalized.split(/* @__PURE__ */ new RegExp(`(${splitPattern})`));
107985
107992
  const nodes = [];
107986
- for (let i$1 = 0;i$1 < parts.length; i$1++) {
107987
- if (parts[i$1])
107988
- nodes.push(schema.text(parts[i$1], marks));
107989
- if (i$1 < parts.length - 1)
107993
+ for (const part of parts) {
107994
+ if (part === "")
107995
+ continue;
107996
+ if (part === "\t" && tabNodeType)
107990
107997
  nodes.push(tabNodeType.create(null, null, tabMarks));
107998
+ else if (part === `
107999
+ ` && lineBreakNodeType)
108000
+ nodes.push(lineBreakNodeType.create());
108001
+ else
108002
+ nodes.push(schema.text(part, marks));
107991
108003
  }
107992
108004
  return Fragment.from(nodes);
107993
108005
  }
@@ -108029,6 +108041,8 @@ function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback, opt
108029
108041
  }
108030
108042
  if (node3.isLeaf) {
108031
108043
  if (node3.isInline) {
108044
+ if (options.textModel === "visible" && node3.marks?.some((mark) => mark.type.name === "trackDelete"))
108045
+ return false;
108032
108046
  const leafTextFn = node3.type?.spec?.leafText;
108033
108047
  if (typeof leafTextFn === "function")
108034
108048
  out += leafTextFn(node3);
@@ -134037,11 +134051,11 @@ var isRegExp = (value) => {
134037
134051
  state.kern = kernNode.attributes["w:val"];
134038
134052
  }
134039
134053
  }, SuperConverter;
134040
- var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
134054
+ var init_SuperConverter_CJi2bUhE_es = __esm(() => {
134041
134055
  init_rolldown_runtime_Bg48TavK_es();
134042
134056
  init_jszip_C49i9kUs_es();
134043
134057
  init_xml_js_CqGKpaft_es();
134044
- init_uuid_qzgm05fK_es();
134058
+ init_uuid_B2wVPhPi_es();
134045
134059
  init_constants_D9qj59G2_es();
134046
134060
  init_dist_B8HfvhaK_es();
134047
134061
  init_unified_Dsuw2be5_es();
@@ -173374,7 +173388,7 @@ var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
173374
173388
  };
173375
173389
  });
173376
173390
 
173377
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-pilP-Jq-.es.js
173391
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B3f9Th4u.es.js
173378
173392
  function parseSizeUnit(val = "0") {
173379
173393
  const length3 = val.toString() || "0";
173380
173394
  const value = Number.parseFloat(length3);
@@ -177222,6 +177236,8 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177222
177236
  const absTo = mapping.map(target.absTo);
177223
177237
  const replacementText = getReplacementText(step3.args.replacement);
177224
177238
  const marks = resolveMarksForRange(editor, target, step3);
177239
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177240
+ const parentAllowsLineBreakAt = (pos) => lineBreakNodeType ? parentAllowsNodeAt(tr, pos, lineBreakNodeType) : false;
177225
177241
  const structuralRewrite = resolveStructuralRangeRewrite(tr.doc, absFrom, absTo, step3);
177226
177242
  if (structuralRewrite) {
177227
177243
  const slice2 = buildReplacementParagraphSlice(editor, structuralRewrite.replacementBlocks, marks, structuralRewrite.paragraphAttrs, step3.id, structuralRewrite.leadingWrappers, structuralRewrite.trailingWrappers, structuralRewrite.openStart, structuralRewrite.openEnd);
@@ -177249,7 +177265,7 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177249
177265
  tr.delete(absFrom, absTo);
177250
177266
  return { changed: target.text.length > 0 };
177251
177267
  }
177252
- const content2 = buildTextWithTabs(editor.state.schema, replacementText, asProseMirrorMarks(marks));
177268
+ const content2 = buildTextWithTabs(editor.state.schema, replacementText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(absFrom) });
177253
177269
  tr.replaceWith(absFrom, absTo, content2);
177254
177270
  return { changed: replacementText !== target.text };
177255
177271
  }
@@ -177291,17 +177307,17 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177291
177307
  if (change.type === "delete")
177292
177308
  tr.delete(remap(change.docFrom), remap(change.docTo));
177293
177309
  else if (change.type === "insert") {
177294
- const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
177310
+ const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(remap(change.docPos)) });
177295
177311
  tr.insert(remap(change.docPos), content2);
177296
177312
  } else {
177297
- const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
177313
+ const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(remap(change.docFrom)) });
177298
177314
  tr.replaceWith(remap(change.docFrom), remap(change.docTo), content2);
177299
177315
  }
177300
177316
  }
177301
177317
  } else if (trimmedNew.length === 0)
177302
177318
  tr.delete(trimmedFrom, trimmedTo);
177303
177319
  else {
177304
- const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks));
177320
+ const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(trimmedFrom) });
177305
177321
  tr.replaceWith(trimmedFrom, trimmedTo, content2);
177306
177322
  }
177307
177323
  return { changed: replacementText !== target.text };
@@ -177372,7 +177388,12 @@ function executeTextInsert(editor, tr, target, step3, mapping) {
177372
177388
  }
177373
177389
  const tabNodeType = editor.state.schema.nodes?.tab;
177374
177390
  const parentAllowsTab = tabNodeType && text4.includes("\t") ? parentAllowsNodeAt(tr, absPos, tabNodeType) : false;
177375
- tr.insert(absPos, buildTextWithTabs(editor.state.schema, text4, marks, { parentAllowsTab }));
177391
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177392
+ const parentAllowsLineBreak = lineBreakNodeType && /[\r\n]/.test(text4) ? parentAllowsNodeAt(tr, absPos, lineBreakNodeType) : false;
177393
+ tr.insert(absPos, buildTextWithTabs(editor.state.schema, text4, marks, {
177394
+ parentAllowsTab,
177395
+ parentAllowsLineBreak
177396
+ }));
177376
177397
  return { changed: true };
177377
177398
  }
177378
177399
  function executeTextDelete(_editor, tr, target, _step, mapping) {
@@ -177466,7 +177487,9 @@ function executeSpanTextRewrite(editor, tr, target, step3, mapping) {
177466
177487
  const absTo = mapping.map(lastSeg.absTo, -1);
177467
177488
  if (replacementBlocks.length === 1) {
177468
177489
  const marks = resolveSpanMarks(editor, target, policy, step3.id);
177469
- const content2 = buildTextWithTabs(editor.state.schema, replacementBlocks[0], asProseMirrorMarks(marks));
177490
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177491
+ const parentAllowsLineBreak = lineBreakNodeType ? parentAllowsNodeAt(tr, absFrom, lineBreakNodeType) : false;
177492
+ const content2 = buildTextWithTabs(editor.state.schema, replacementBlocks[0], asProseMirrorMarks(marks), { parentAllowsLineBreak });
177470
177493
  tr.replaceWith(absFrom, absTo, content2);
177471
177494
  return { changed: true };
177472
177495
  }
@@ -178693,7 +178716,7 @@ function materializeTab(schema) {
178693
178716
  return nodeType.create();
178694
178717
  }
178695
178718
  function materializeLineBreak(schema) {
178696
- const nodeType = schema.nodes.hardBreak ?? schema.nodes.lineBreak;
178719
+ const nodeType = schema.nodes.lineBreak ?? schema.nodes.hardBreak;
178697
178720
  if (!nodeType)
178698
178721
  return schema.text(`
178699
178722
  `);
@@ -183723,9 +183746,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
183723
183746
  }
183724
183747
  };
183725
183748
  };
183726
- var init_create_headless_toolbar_pilP_Jq_es = __esm(() => {
183727
- init_SuperConverter_DOoAJ6Zk_es();
183728
- init_uuid_qzgm05fK_es();
183749
+ var init_create_headless_toolbar_B3f9Th4u_es = __esm(() => {
183750
+ init_SuperConverter_CJi2bUhE_es();
183751
+ init_uuid_B2wVPhPi_es();
183729
183752
  init_constants_D9qj59G2_es();
183730
183753
  init_dist_B8HfvhaK_es();
183731
183754
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -232887,7 +232910,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
232887
232910
  init_remark_gfm_BhnWr3yf_es();
232888
232911
  });
232889
232912
 
232890
- // ../../packages/superdoc/dist/chunks/src-CWo3dWd9.es.js
232913
+ // ../../packages/superdoc/dist/chunks/src-Bp0jHIlx.es.js
232891
232914
  function deleteProps(obj, propOrProps) {
232892
232915
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
232893
232916
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -264478,7 +264501,12 @@ function insertTextAroundSdt(editor, target, content3, resolvePos) {
264478
264501
  const { tr } = editor.state;
264479
264502
  const tabType = editor.schema.nodes?.tab;
264480
264503
  const parentAllowsTab = tabType && content3.includes("\t") ? parentAllowsNodeAt(tr, pos, tabType) : false;
264481
- tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, { parentAllowsTab }));
264504
+ const lineBreakType = editor.schema.nodes?.lineBreak;
264505
+ const parentAllowsLineBreak = lineBreakType && /[\r\n]/.test(content3) ? parentAllowsNodeAt(tr, pos, lineBreakType) : false;
264506
+ tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, {
264507
+ parentAllowsTab,
264508
+ parentAllowsLineBreak
264509
+ }));
264482
264510
  dispatchTransaction$1(editor, tr);
264483
264511
  return true;
264484
264512
  }
@@ -306611,17 +306639,25 @@ var Node$13 = class Node$14 {
306611
306639
  this.deco = deco;
306612
306640
  }
306613
306641
  }, searchKey, BLOCK_SEPARATOR = `
306614
- `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
306642
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, readLeafText = (node3) => {
306643
+ const leafText = node3?.type?.spec?.leafText;
306644
+ if (typeof leafText === "function")
306645
+ return leafText(node3);
306646
+ if (typeof leafText === "string")
306647
+ return leafText;
306648
+ return ATOM_PLACEHOLDER;
306649
+ }, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
306615
306650
  const matches2 = [];
306616
306651
  for (const indexMatch of indexMatches) {
306617
306652
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
306618
306653
  if (ranges.length === 0)
306619
306654
  continue;
306620
306655
  const matchTexts = ranges.map((r$1) => doc$12.textBetween(r$1.from, r$1.to));
306656
+ const matchText = typeof indexMatch.text === "string" ? indexMatch.text : matchTexts.join("");
306621
306657
  const match$1 = {
306622
306658
  from: ranges[0].from,
306623
306659
  to: ranges[ranges.length - 1].to,
306624
- text: matchTexts.join(""),
306660
+ text: matchText,
306625
306661
  id: v4_default(),
306626
306662
  ranges,
306627
306663
  trackerIds: []
@@ -330205,13 +330241,13 @@ menclose::after {
330205
330241
  return;
330206
330242
  console.log(...args$1);
330207
330243
  }, 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;
330208
- var init_src_CWo3dWd9_es = __esm(() => {
330244
+ var init_src_Bp0jHIlx_es = __esm(() => {
330209
330245
  init_rolldown_runtime_Bg48TavK_es();
330210
- init_SuperConverter_DOoAJ6Zk_es();
330246
+ init_SuperConverter_CJi2bUhE_es();
330211
330247
  init_jszip_C49i9kUs_es();
330212
330248
  init_xml_js_CqGKpaft_es();
330213
- init_uuid_qzgm05fK_es();
330214
- init_create_headless_toolbar_pilP_Jq_es();
330249
+ init_uuid_B2wVPhPi_es();
330250
+ init_create_headless_toolbar_B3f9Th4u_es();
330215
330251
  init_constants_D9qj59G2_es();
330216
330252
  init_dist_B8HfvhaK_es();
330217
330253
  init_unified_Dsuw2be5_es();
@@ -334109,10 +334145,12 @@ ${err.toString()}`);
334109
334145
  return false;
334110
334146
  const { $from } = selection;
334111
334147
  let paragraph2 = null;
334148
+ let paragraphDepth = null;
334112
334149
  for (let d = $from.depth;d >= 0; d--) {
334113
334150
  const node3 = $from.node(d);
334114
334151
  if (node3.type.name === "paragraph") {
334115
334152
  paragraph2 = node3;
334153
+ paragraphDepth = d;
334116
334154
  break;
334117
334155
  }
334118
334156
  }
@@ -334122,7 +334160,14 @@ ${err.toString()}`);
334122
334160
  return false;
334123
334161
  if (!isVisuallyEmptyParagraph(paragraph2) && !hasOnlyBreakContent(paragraph2))
334124
334162
  return false;
334125
- const tr = state.tr.insertText(event.data);
334163
+ let tr = state.tr;
334164
+ if (hasOnlyBreakContent(paragraph2) && paragraphDepth != null) {
334165
+ const contentStart = $from.start(paragraphDepth);
334166
+ const contentEnd = $from.end(paragraphDepth);
334167
+ tr = tr.delete(contentStart, contentEnd).insertText(event.data, contentStart);
334168
+ tr = tr.setSelection(TextSelection.create(tr.doc, contentStart + event.data.length));
334169
+ } else
334170
+ tr = tr.insertText(event.data);
334126
334171
  view.dispatch(tr);
334127
334172
  event.preventDefault();
334128
334173
  return true;
@@ -334442,6 +334487,8 @@ ${err.toString()}`);
334442
334487
  selectable: false,
334443
334488
  content: "",
334444
334489
  atom: true,
334490
+ leafText: () => `
334491
+ `,
334445
334492
  addOptions() {
334446
334493
  return {};
334447
334494
  },
@@ -348273,7 +348320,7 @@ function print() { __p += __j.call(arguments, '') }
348273
348320
  if (searchModel === "visible")
348274
348321
  this.#buildVisible(doc$12);
348275
348322
  else
348276
- this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, ATOM_PLACEHOLDER);
348323
+ this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, readLeafText);
348277
348324
  this.segments = [];
348278
348325
  this.docSize = doc$12.content.size;
348279
348326
  this.doc = doc$12;
@@ -348320,7 +348367,11 @@ function print() { __p += __j.call(arguments, '') }
348320
348367
  return;
348321
348368
  }
348322
348369
  if (node3.isLeaf) {
348323
- parts.push(ATOM_PLACEHOLDER);
348370
+ if (hasTrackDeleteMark$2(node3)) {
348371
+ appendDeletionBarrier();
348372
+ return;
348373
+ }
348374
+ parts.push(readLeafText(node3));
348324
348375
  emittedDeletionBarrier = false;
348325
348376
  return;
348326
348377
  }
@@ -348383,26 +348434,43 @@ function print() { __p += __j.call(arguments, '') }
348383
348434
  return offset$1;
348384
348435
  }
348385
348436
  if (node3.isLeaf) {
348437
+ if (searchModel === "visible" && hasTrackDeleteMark$2(node3)) {
348438
+ if (context?.deletionBarrierActive)
348439
+ return offset$1;
348440
+ addSegment({
348441
+ offsetStart: offset$1,
348442
+ offsetEnd: offset$1 + 1,
348443
+ docFrom: docPos,
348444
+ docTo: docPos + node3.nodeSize,
348445
+ kind: "atom"
348446
+ });
348447
+ if (context)
348448
+ context.deletionBarrierActive = true;
348449
+ return offset$1 + 1;
348450
+ }
348386
348451
  if (context && searchModel === "visible")
348387
348452
  context.deletionBarrierActive = false;
348453
+ const leafText = readLeafText(node3);
348454
+ if (leafText.length === 0)
348455
+ return offset$1;
348388
348456
  if (node3.type.name === "hard_break") {
348389
348457
  addSegment({
348390
348458
  offsetStart: offset$1,
348391
- offsetEnd: offset$1 + 1,
348459
+ offsetEnd: offset$1 + leafText.length,
348392
348460
  docFrom: docPos,
348393
348461
  docTo: docPos + node3.nodeSize,
348394
348462
  kind: "hardBreak"
348395
348463
  });
348396
- return offset$1 + 1;
348464
+ return offset$1 + leafText.length;
348397
348465
  }
348398
348466
  addSegment({
348399
348467
  offsetStart: offset$1,
348400
- offsetEnd: offset$1 + 1,
348468
+ offsetEnd: offset$1 + leafText.length,
348401
348469
  docFrom: docPos,
348402
348470
  docTo: docPos + node3.nodeSize,
348403
348471
  kind: "atom"
348404
348472
  });
348405
- return offset$1 + 1;
348473
+ return offset$1 + leafText.length;
348406
348474
  }
348407
348475
  return this.#walkNodeContent(node3, docPos + 1, offset$1, addSegment, searchModel, context);
348408
348476
  }
@@ -348419,24 +348487,56 @@ function print() { __p += __j.call(arguments, '') }
348419
348487
  }
348420
348488
  offsetRangeToDocRanges(start$1, end$1) {
348421
348489
  const ranges = [];
348490
+ let current = null;
348422
348491
  for (const segment of this.segments) {
348423
348492
  if (segment.offsetEnd <= start$1)
348424
348493
  continue;
348425
348494
  if (segment.offsetStart >= end$1)
348426
348495
  break;
348427
- if (segment.kind !== "text")
348496
+ if (segment.kind === "blockSep") {
348497
+ if (current) {
348498
+ ranges.push({
348499
+ from: current.from,
348500
+ to: current.to
348501
+ });
348502
+ current = null;
348503
+ }
348428
348504
  continue;
348505
+ }
348429
348506
  const overlapStart = Math.max(start$1, segment.offsetStart);
348430
348507
  const overlapEnd = Math.min(end$1, segment.offsetEnd);
348431
- if (overlapStart < overlapEnd) {
348432
- const startInSegment = overlapStart - segment.offsetStart;
348433
- const endInSegment = overlapEnd - segment.offsetStart;
348434
- ranges.push({
348435
- from: segment.docFrom + startInSegment,
348436
- to: segment.docFrom + endInSegment
348437
- });
348508
+ if (overlapStart >= overlapEnd)
348509
+ continue;
348510
+ let from$1;
348511
+ let to;
348512
+ if (segment.kind === "text") {
348513
+ from$1 = segment.docFrom + (overlapStart - segment.offsetStart);
348514
+ to = segment.docFrom + (overlapEnd - segment.offsetStart);
348515
+ } else {
348516
+ from$1 = segment.docFrom;
348517
+ to = segment.docTo;
348518
+ }
348519
+ if (current && segment.offsetStart === current.offsetEnd && from$1 === current.to) {
348520
+ current.to = to;
348521
+ current.offsetEnd = overlapEnd;
348522
+ } else {
348523
+ if (current)
348524
+ ranges.push({
348525
+ from: current.from,
348526
+ to: current.to
348527
+ });
348528
+ current = {
348529
+ from: from$1,
348530
+ to,
348531
+ offsetEnd: overlapEnd
348532
+ };
348438
348533
  }
348439
348534
  }
348535
+ if (current)
348536
+ ranges.push({
348537
+ from: current.from,
348538
+ to: current.to
348539
+ });
348440
348540
  return ranges;
348441
348541
  }
348442
348542
  offsetToDocPos(offset$1) {
@@ -365051,11 +365151,11 @@ function print() { __p += __j.call(arguments, '') }
365051
365151
  ]);
365052
365152
  });
365053
365153
 
365054
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DUlu2DFj.es.js
365154
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DjZHlQQ4.es.js
365055
365155
  var headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
365056
- var init_create_super_doc_ui_DUlu2DFj_es = __esm(() => {
365057
- init_SuperConverter_DOoAJ6Zk_es();
365058
- init_create_headless_toolbar_pilP_Jq_es();
365156
+ var init_create_super_doc_ui_DjZHlQQ4_es = __esm(() => {
365157
+ init_SuperConverter_CJi2bUhE_es();
365158
+ init_create_headless_toolbar_B3f9Th4u_es();
365059
365159
  headlessToolbarConstants = {
365060
365160
  DEFAULT_TEXT_ALIGN_OPTIONS: [
365061
365161
  {
@@ -365337,16 +365437,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
365337
365437
 
365338
365438
  // ../../packages/superdoc/dist/super-editor.es.js
365339
365439
  var init_super_editor_es = __esm(() => {
365340
- init_src_CWo3dWd9_es();
365341
- init_SuperConverter_DOoAJ6Zk_es();
365440
+ init_src_Bp0jHIlx_es();
365441
+ init_SuperConverter_CJi2bUhE_es();
365342
365442
  init_jszip_C49i9kUs_es();
365343
365443
  init_xml_js_CqGKpaft_es();
365344
- init_create_headless_toolbar_pilP_Jq_es();
365444
+ init_create_headless_toolbar_B3f9Th4u_es();
365345
365445
  init_constants_D9qj59G2_es();
365346
365446
  init_dist_B8HfvhaK_es();
365347
365447
  init_unified_Dsuw2be5_es();
365348
365448
  init_DocxZipper_FUsfThjV_es();
365349
- init_create_super_doc_ui_DUlu2DFj_es();
365449
+ init_create_super_doc_ui_DjZHlQQ4_es();
365350
365450
  init_ui_C5PAS9hY_es();
365351
365451
  init_eventemitter3_BnGqBE_Q_es();
365352
365452
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.34",
3
+ "version": "0.16.0-next.35",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,20 +24,20 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/document-api": "0.0.1",
28
27
  "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.38.0"
28
+ "superdoc": "1.38.0",
29
+ "@superdoc/document-api": "0.0.1"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.34",
37
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.34",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.34",
39
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.34",
40
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.34"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.35",
37
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.35",
38
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.35",
39
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.35",
40
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.35"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",