@superdoc-dev/cli 0.5.0-next.67 → 0.5.0-next.69

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 +389 -94
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -57583,7 +57583,7 @@ var init_uuid_qzgm05fK_es = __esm(() => {
57583
57583
  v5_default = v35("v5", 80, sha1);
57584
57584
  });
57585
57585
 
57586
- // ../../packages/superdoc/dist/chunks/constants-5yyN6FZg.es.js
57586
+ // ../../packages/superdoc/dist/chunks/constants-CGhJRd87.es.js
57587
57587
  function computeCrc32Hex(data) {
57588
57588
  let crc = 4294967295;
57589
57589
  for (let i2 = 0;i2 < data.length; i2++)
@@ -57657,6 +57657,11 @@ function linesToTwips(lines) {
57657
57657
  return;
57658
57658
  return lines * 240;
57659
57659
  }
57660
+ function halfPointToPixels(halfPoints) {
57661
+ if (halfPoints == null)
57662
+ return;
57663
+ return Math.round(halfPoints * 96 / 72);
57664
+ }
57660
57665
  function halfPointToPoints(halfPoints) {
57661
57666
  if (halfPoints == null)
57662
57667
  return;
@@ -57975,7 +57980,7 @@ var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArray
57975
57980
  return "webp";
57976
57981
  return null;
57977
57982
  }, COMMENT_FILE_BASENAMES, DEFAULT_XML_DECLARATION, COMMENT_RELATIONSHIP_TYPES;
57978
- var init_constants_5yyN6FZg_es = __esm(() => {
57983
+ var init_constants_CGhJRd87_es = __esm(() => {
57979
57984
  init_xml_js_CqGKpaft_es();
57980
57985
  import_lib = require_lib();
57981
57986
  CRC32_TABLE = new Uint32Array(256);
@@ -65881,7 +65886,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65881
65886
  emptyOptions2 = {};
65882
65887
  });
65883
65888
 
65884
- // ../../packages/superdoc/dist/chunks/SuperConverter-tT-4c8Ha.es.js
65889
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DKPcCGTm.es.js
65885
65890
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65886
65891
  const fieldValue = extension$1.config[field];
65887
65892
  if (typeof fieldValue === "function")
@@ -116186,6 +116191,7 @@ var isRegExp = (value) => {
116186
116191
  else
116187
116192
  pageBreakAfterVal = Number(pageBreakAfter?.attributes?.["w:val"]);
116188
116193
  const basedOn = elementsWithId.find((el) => el.elements.some((inner) => inner.name === "w:basedOn"))?.elements.find((inner) => inner.name === "w:basedOn")?.attributes["w:val"];
116194
+ const linkToCharacterStyle = firstMatch.elements.find((el) => el.name === "w:link")?.attributes?.["w:val"] ?? null;
116189
116195
  const parsedAttrs = {
116190
116196
  name,
116191
116197
  qFormat: qFormat ? true : false,
@@ -116194,7 +116200,8 @@ var isRegExp = (value) => {
116194
116200
  outlineLevel: outlineLevel ? parseInt(outlineLvlValue) : null,
116195
116201
  pageBreakBefore: pageBreakBeforeVal ? true : false,
116196
116202
  pageBreakAfter: pageBreakAfterVal ? true : false,
116197
- basedOn: basedOn ?? null
116203
+ basedOn: basedOn ?? null,
116204
+ link: linkToCharacterStyle
116198
116205
  };
116199
116206
  const parsedMarks = parseMarks(firstMatch.elements.find((el) => el.name === "w:rPr"), [], docx) || [];
116200
116207
  const parsedStyles = {
@@ -117496,12 +117503,12 @@ var isRegExp = (value) => {
117496
117503
  state.kern = kernNode.attributes["w:val"];
117497
117504
  }
117498
117505
  }, SuperConverter;
117499
- var init_SuperConverter_tT_4c8Ha_es = __esm(() => {
117506
+ var init_SuperConverter_DKPcCGTm_es = __esm(() => {
117500
117507
  init_rolldown_runtime_Bg48TavK_es();
117501
117508
  init_jszip_C49i9kUs_es();
117502
117509
  init_xml_js_CqGKpaft_es();
117503
117510
  init_uuid_qzgm05fK_es();
117504
- init_constants_5yyN6FZg_es();
117511
+ init_constants_CGhJRd87_es();
117505
117512
  init_dist_B8HfvhaK_es();
117506
117513
  init_unified_Dsuw2be5_es();
117507
117514
  init_lib_CYqLdG4z_es();
@@ -154588,7 +154595,7 @@ var init_SuperConverter_tT_4c8Ha_es = __esm(() => {
154588
154595
  };
154589
154596
  });
154590
154597
 
154591
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-y2bgJGCh.es.js
154598
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BTSQjUTS.es.js
154592
154599
  function parseSizeUnit(val = "0") {
154593
154600
  const length3 = val.toString() || "0";
154594
154601
  const value = Number.parseFloat(length3);
@@ -155781,11 +155788,34 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155781
155788
  }
155782
155789
  });
155783
155790
  return Object.entries(markValue).map(([key$1, value]) => `${key$1}: ${value}`).join(";");
155791
+ }, getParagraphTextBounds = (doc2, paragraphPos, paragraphNode) => {
155792
+ let minPos = null;
155793
+ let maxPos = null;
155794
+ const innerStart = paragraphPos + 1;
155795
+ const innerEnd = paragraphPos + paragraphNode.nodeSize - 1;
155796
+ doc2.nodesBetween(innerStart, innerEnd, (node3, pos) => {
155797
+ if (node3.isText) {
155798
+ if (minPos === null || pos < minPos)
155799
+ minPos = pos;
155800
+ maxPos = pos + node3.nodeSize;
155801
+ }
155802
+ return true;
155803
+ });
155804
+ if (minPos === null || maxPos === null)
155805
+ return null;
155806
+ return {
155807
+ from: minPos,
155808
+ to: maxPos
155809
+ };
155810
+ }, applyCharacterStyleMarkToRange = (tr, textStyleType, from5, to, styleId) => {
155811
+ tr.removeMark(from5, to, textStyleType);
155812
+ tr.addMark(from5, to, textStyleType.create({ styleId }));
155784
155813
  }, applyLinkedStyleToTransaction = (tr, editor, style) => {
155785
155814
  if (!style)
155786
155815
  return false;
155787
155816
  let selection = tr.selection;
155788
155817
  const state = editor.state;
155818
+ const textStyleType = editor.schema.marks.textStyle;
155789
155819
  const focusState = CustomSelectionPluginKey.getState(state);
155790
155820
  if (selection.empty && focusState?.preservedSelection && !focusState?.preservedSelection.empty) {
155791
155821
  selection = focusState.preservedSelection;
@@ -155804,13 +155834,19 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155804
155834
  }
155805
155835
  };
155806
155836
  };
155807
- const clearFormattingMarks = (startPos, endPos) => {
155808
- tr.doc.nodesBetween(startPos, endPos, (node3, pos) => {
155809
- if (node3.isText && node3.marks.length > 0)
155810
- node3.marks.forEach((mark) => {
155811
- if (FORMATTING_MARK_NAMES.has(mark.type.name))
155812
- tr.removeMark(pos, pos + node3.nodeSize, mark);
155813
- });
155837
+ const clearFormattingMarks = (rangeFrom, rangeTo) => {
155838
+ tr.doc.nodesBetween(rangeFrom, rangeTo, (node3, pos) => {
155839
+ if (!node3.isText || node3.marks.length === 0)
155840
+ return true;
155841
+ const nodeEnd = pos + node3.nodeSize;
155842
+ const clearFrom = Math.max(pos, rangeFrom);
155843
+ const clearTo = Math.min(nodeEnd, rangeTo);
155844
+ if (clearFrom >= clearTo)
155845
+ return true;
155846
+ node3.marks.forEach((mark) => {
155847
+ if (FORMATTING_MARK_NAMES.has(mark.type.name))
155848
+ tr.removeMark(clearFrom, clearTo, mark);
155849
+ });
155814
155850
  return true;
155815
155851
  });
155816
155852
  };
@@ -155822,6 +155858,19 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155822
155858
  if (nextStoredMarks.length !== sourceMarks.length)
155823
155859
  tr.setStoredMarks(nextStoredMarks);
155824
155860
  };
155861
+ if (style.type === "character") {
155862
+ if (!textStyleType)
155863
+ return false;
155864
+ if (from5 === to) {
155865
+ const filtered = (tr.storedMarks ?? state.storedMarks ?? selection.$from.marks()).filter((mark) => mark.type !== textStyleType);
155866
+ tr.setStoredMarks([...filtered, textStyleType.create({ styleId: style.id })]);
155867
+ return true;
155868
+ }
155869
+ clearFormattingMarks(from5, to);
155870
+ applyCharacterStyleMarkToRange(tr, textStyleType, from5, to, style.id);
155871
+ clearStoredFormattingMarks();
155872
+ return true;
155873
+ }
155825
155874
  if (from5 === to) {
155826
155875
  let pos = from5;
155827
155876
  let paragraphNode = tr.doc.nodeAt(from5);
@@ -155837,6 +155886,25 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155837
155886
  tr.setNodeMarkup(pos, undefined, getUpdatedParagraphAttrs(paragraphNode));
155838
155887
  return true;
155839
155888
  }
155889
+ if (style.type === "paragraph" && textStyleType) {
155890
+ const linkedCharStyleId = style.definition?.attrs?.link;
155891
+ if (linkedCharStyleId) {
155892
+ const $fromPos = tr.doc.resolve(from5);
155893
+ const $toPos = tr.doc.resolve(to);
155894
+ const startPara = findParentNodeClosestToPos($fromPos, (n) => n.type.name === "paragraph");
155895
+ const endPara = findParentNodeClosestToPos($toPos, (n) => n.type.name === "paragraph");
155896
+ if (startPara && endPara && startPara.pos === endPara.pos) {
155897
+ const bounds = getParagraphTextBounds(tr.doc, startPara.pos, startPara.node);
155898
+ const coversFullParagraphText = bounds && from5 <= bounds.from && to >= bounds.to;
155899
+ if (bounds && !coversFullParagraphText) {
155900
+ clearFormattingMarks(from5, to);
155901
+ applyCharacterStyleMarkToRange(tr, textStyleType, from5, to, linkedCharStyleId);
155902
+ clearStoredFormattingMarks();
155903
+ return true;
155904
+ }
155905
+ }
155906
+ }
155907
+ }
155840
155908
  const paragraphPositions = [];
155841
155909
  tr.doc.nodesBetween(from5, to, (node3, pos) => {
155842
155910
  if (node3.type.name === "paragraph")
@@ -155846,6 +155914,20 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155846
155914
  });
155847
155915
  return true;
155848
155916
  });
155917
+ if (paragraphPositions.length === 0 && from5 !== to) {
155918
+ const seen = /* @__PURE__ */ new Set;
155919
+ const pushParagraph = (info) => {
155920
+ if (!info || seen.has(info.pos))
155921
+ return;
155922
+ seen.add(info.pos);
155923
+ paragraphPositions.push({
155924
+ node: info.node,
155925
+ pos: info.pos
155926
+ });
155927
+ };
155928
+ pushParagraph(findParentNodeClosestToPos(tr.doc.resolve(from5), (n) => n.type.name === "paragraph"));
155929
+ pushParagraph(findParentNodeClosestToPos(tr.doc.resolve(to), (n) => n.type.name === "paragraph"));
155930
+ }
155849
155931
  paragraphPositions.forEach(({ node: node3, pos }) => {
155850
155932
  clearFormattingMarks(pos + 1, pos + node3.nodeSize - 1);
155851
155933
  tr.setNodeMarkup(pos, undefined, getUpdatedParagraphAttrs(node3));
@@ -156124,9 +156206,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
156124
156206
  return false;
156125
156207
  return Boolean(checker(attrs));
156126
156208
  };
156127
- var init_create_headless_toolbar_y2bgJGCh_es = __esm(() => {
156128
- init_SuperConverter_tT_4c8Ha_es();
156129
- init_constants_5yyN6FZg_es();
156209
+ var init_create_headless_toolbar_BTSQjUTS_es = __esm(() => {
156210
+ init_SuperConverter_DKPcCGTm_es();
156211
+ init_constants_CGhJRd87_es();
156130
156212
  init_dist_B8HfvhaK_es();
156131
156213
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
156132
156214
  DOM_SIZE_UNITS = [
@@ -157572,7 +157654,7 @@ var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
157572
157654
  ]);
157573
157655
  });
157574
157656
 
157575
- // ../../packages/superdoc/dist/chunks/DocxZipper-UDBAhMbp.es.js
157657
+ // ../../packages/superdoc/dist/chunks/DocxZipper-CaIWmehq.es.js
157576
157658
  function sniffEncoding(u8) {
157577
157659
  if (u8.length >= 2) {
157578
157660
  const b0 = u8[0], b1 = u8[1];
@@ -158217,11 +158299,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
158217
158299
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
158218
158300
  }
158219
158301
  }, DocxZipper_default;
158220
- var init_DocxZipper_UDBAhMbp_es = __esm(() => {
158302
+ var init_DocxZipper_CaIWmehq_es = __esm(() => {
158221
158303
  init_rolldown_runtime_Bg48TavK_es();
158222
158304
  init_jszip_C49i9kUs_es();
158223
158305
  init_xml_js_CqGKpaft_es();
158224
- init_constants_5yyN6FZg_es();
158306
+ init_constants_CGhJRd87_es();
158225
158307
  init_dist_B8HfvhaK_es();
158226
158308
  MANAGED_PACKAGE_PARTS = [
158227
158309
  {
@@ -204563,7 +204645,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204563
204645
  init_remark_gfm_BhnWr3yf_es();
204564
204646
  });
204565
204647
 
204566
- // ../../packages/superdoc/dist/chunks/src-BzK2Ejl0.es.js
204648
+ // ../../packages/superdoc/dist/chunks/src-CX93tpZZ.es.js
204567
204649
  function deleteProps(obj, propOrProps) {
204568
204650
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204569
204651
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -206492,6 +206574,7 @@ function splitBlockPatch(state, dispatch, editor) {
206492
206574
  atEnd = $from.end(d) == $from.pos + ($from.depth - d);
206493
206575
  atStart = $from.start(d) == $from.pos - ($from.depth - d);
206494
206576
  deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
206577
+ const sourceParagraphStyleId = node3.attrs?.paragraphProperties?.styleId;
206495
206578
  paragraphAttrs = {
206496
206579
  ...node3.attrs,
206497
206580
  sdBlockId: null,
@@ -206500,8 +206583,20 @@ function splitBlockPatch(state, dispatch, editor) {
206500
206583
  textId: null
206501
206584
  };
206502
206585
  paragraphAttrs = clearInheritedLinkedStyleId(paragraphAttrs, editor, { emptyParagraph: atEnd });
206503
- if (atEnd && $from.parent.type.name === "run")
206504
- paragraphAttrs = syncSplitParagraphRunProperties(paragraphAttrs, getSplitRunProperties(state, $from));
206586
+ if (atEnd && $from.parent.type.name === "run") {
206587
+ if (!isLinkedParagraphStyleId(editor, sourceParagraphStyleId))
206588
+ paragraphAttrs = syncSplitParagraphRunProperties(paragraphAttrs, getSplitRunProperties(state, $from));
206589
+ const pp = paragraphAttrs?.paragraphProperties;
206590
+ const runStyleIsLinkedCharacter = isLinkedCharacterStyleId(editor, pp?.runProperties?.styleId);
206591
+ if (pp && (isLinkedParagraphStyleId(editor, sourceParagraphStyleId) || runStyleIsLinkedCharacter)) {
206592
+ const nextPp = { ...pp };
206593
+ delete nextPp.runProperties;
206594
+ paragraphAttrs = {
206595
+ ...paragraphAttrs,
206596
+ paragraphProperties: nextPp
206597
+ };
206598
+ }
206599
+ }
206505
206600
  types3.unshift({
206506
206601
  type: deflt || node3.type,
206507
206602
  attrs: paragraphAttrs
@@ -206575,7 +206670,7 @@ function applyStyleMarks(state, tr, editor, paragraphAttrs, tableInfo) {
206575
206670
  };
206576
206671
  const runProperties = styleId ? resolveRunProperties(params$1, {}, styleId ? { styleId } : {}, tableInfo, false, Boolean(paragraphAttrs.paragraphProperties?.numberingProperties)) : {};
206577
206672
  const markDefsFromStyle = styleId ? encodeMarksFromRPr(runProperties, editor?.converter?.convertedXml ?? {}) : [];
206578
- const selectionMarks = state.selection?.$from?.marks ? state.selection.$from.marks() : [];
206673
+ const selectionMarks = tr.selection?.$from?.marks ? tr.selection.$from.marks() : [];
206579
206674
  const selectionMarkDefs = selectionMarks.map((mark2) => ({
206580
206675
  type: mark2.type.name,
206581
206676
  attrs: mark2.attrs
@@ -209396,6 +209491,15 @@ function getCurrentCellAttrs(state) {
209396
209491
  attrs: copyCellAttrs(cell2)
209397
209492
  };
209398
209493
  }
209494
+ function parseCellVerticalAlignFromStyle(element3) {
209495
+ const value = element3.style?.verticalAlign;
209496
+ if (!value || typeof value !== "string")
209497
+ return null;
209498
+ const normalized = value.trim().toLowerCase();
209499
+ if (normalized === "middle")
209500
+ return "center";
209501
+ return normalized;
209502
+ }
209399
209503
  function findRemovedFieldAnnotations(tr) {
209400
209504
  let removedNodes = [];
209401
209505
  if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta2) => [
@@ -263339,6 +263443,13 @@ var Node$13 = class Node$14 {
263339
263443
  return false;
263340
263444
  const styleDefinition = readTranslatedLinkedStyles(editor)?.styles?.[styleId];
263341
263445
  return Boolean(styleDefinition?.type === "paragraph" && styleDefinition?.link);
263446
+ }, isLinkedCharacterStyleId = (editor, styleId) => {
263447
+ if (!styleId)
263448
+ return false;
263449
+ const translatedStyles = readTranslatedLinkedStyles(editor)?.styles;
263450
+ if (!translatedStyles)
263451
+ return false;
263452
+ return Object.values(translatedStyles).some((def) => def?.type === "paragraph" && def?.link === styleId);
263342
263453
  }, clearInheritedLinkedStyleId = (attrs, editor, { emptyParagraph = false } = {}) => {
263343
263454
  if (!emptyParagraph)
263344
263455
  return attrs;
@@ -266741,7 +266852,87 @@ var Node$13 = class Node$14 {
266741
266852
  const nextAttrs = { ...attrs };
266742
266853
  delete nextAttrs.borders;
266743
266854
  return nextAttrs;
266744
- }, IMPORT_CONTEXT_SELECTOR = '[data-superdoc-import="true"]', IMPORT_DEFAULT_TABLE_WIDTH_PCT = 5000, isImportedTableElement = (element3) => Boolean(element3?.closest?.(IMPORT_CONTEXT_SELECTOR)), Table, renderCellBorderStyle = (borders) => {
266855
+ }, IMPORT_CONTEXT_SELECTOR = '[data-superdoc-import="true"]', IMPORT_DEFAULT_TABLE_WIDTH_PCT = 5000, isImportedTableElement = (element3) => Boolean(element3?.closest?.(IMPORT_CONTEXT_SELECTOR)), Table, STYLE_TOKEN_SET, STYLE_TOKEN_PATTERN, parseBorderWidth = (value) => {
266856
+ const widthMatch = value.match(/(?:^|\s)(-?\d*\.?\d+(?:px|pt))(?=\s|$)/i);
266857
+ if (!widthMatch?.[1])
266858
+ return null;
266859
+ const [widthValue, widthUnit] = parseSizeUnit(widthMatch[1]);
266860
+ const numericWidth = Number(widthValue);
266861
+ return widthUnit === "pt" ? halfPointToPixels(numericWidth) : numericWidth;
266862
+ }, parseBorderStyle = (value) => {
266863
+ const styleMatch = value.match(new RegExp(`(?:^|\\s)(${STYLE_TOKEN_PATTERN})(?=\\s|$)`, "i"));
266864
+ return styleMatch?.[1] ? styleMatch[1].toLowerCase() : null;
266865
+ }, parseBorderColor = (value) => {
266866
+ const directColorMatch = value.match(/(rgba?\([^)]+\)|hsla?\([^)]+\)|#[0-9a-fA-F]{3,8}|var\([^)]+\))/i);
266867
+ if (directColorMatch?.[1])
266868
+ return directColorMatch[1];
266869
+ return value.split(/\s+/).find((part) => /^[a-z]+$/i.test(part) && !STYLE_TOKEN_SET.has(part.toLowerCase())) || null;
266870
+ }, parseBorderValue = (rawValue) => {
266871
+ if (!rawValue || typeof rawValue !== "string")
266872
+ return null;
266873
+ const value = rawValue.trim();
266874
+ if (!value)
266875
+ return null;
266876
+ if (value === "none")
266877
+ return {
266878
+ val: "none",
266879
+ size: 0,
266880
+ color: "auto",
266881
+ style: "none"
266882
+ };
266883
+ const size$1 = parseBorderWidth(value);
266884
+ const style2 = parseBorderStyle(value);
266885
+ const hexColor = cssColorToHex(parseBorderColor(value));
266886
+ if (style2 === "none")
266887
+ return {
266888
+ val: "none",
266889
+ size: 0,
266890
+ color: "auto",
266891
+ style: "none"
266892
+ };
266893
+ if (size$1 == null && !hexColor && !style2)
266894
+ return null;
266895
+ return {
266896
+ val: style2 === "dashed" || style2 === "dotted" ? style2 : "single",
266897
+ size: size$1 ?? 1,
266898
+ color: hexColor || "auto",
266899
+ style: style2 || "solid"
266900
+ };
266901
+ }, parseCellBorders = (element3) => {
266902
+ const { style: style2 } = element3;
266903
+ const top$1 = parseBorderValue(style2?.borderTop || style2?.border);
266904
+ const right$1 = parseBorderValue(style2?.borderRight || style2?.border);
266905
+ const bottom$1 = parseBorderValue(style2?.borderBottom || style2?.border);
266906
+ const left$1 = parseBorderValue(style2?.borderLeft || style2?.border);
266907
+ if (!top$1 && !right$1 && !bottom$1 && !left$1)
266908
+ return null;
266909
+ return {
266910
+ ...top$1 ? { top: top$1 } : {},
266911
+ ...right$1 ? { right: right$1 } : {},
266912
+ ...bottom$1 ? { bottom: bottom$1 } : {},
266913
+ ...left$1 ? { left: left$1 } : {}
266914
+ };
266915
+ }, parseSide = (sideValue) => {
266916
+ if (!sideValue)
266917
+ return;
266918
+ const [rawValue, unit] = parseSizeUnit(sideValue);
266919
+ const numericValue = Number(rawValue);
266920
+ return unit === "pt" ? halfPointToPixels(numericValue) : numericValue;
266921
+ }, parseCellMargins = (element3) => {
266922
+ const { style: style2 } = element3;
266923
+ const top$1 = parseSide(style2?.paddingTop);
266924
+ const right$1 = parseSide(style2?.paddingRight);
266925
+ const bottom$1 = parseSide(style2?.paddingBottom);
266926
+ const left$1 = parseSide(style2?.paddingLeft);
266927
+ if (top$1 == null && right$1 == null && bottom$1 == null && left$1 == null)
266928
+ return null;
266929
+ return {
266930
+ ...top$1 != null ? { top: top$1 } : {},
266931
+ ...right$1 != null ? { right: right$1 } : {},
266932
+ ...bottom$1 != null ? { bottom: bottom$1 } : {},
266933
+ ...left$1 != null ? { left: left$1 } : {}
266934
+ };
266935
+ }, renderCellBorderStyle = (borders) => {
266745
266936
  if (!borders)
266746
266937
  return {};
266747
266938
  return { style: [
@@ -266760,7 +266951,49 @@ var Node$13 = class Node$14 {
266760
266951
  return `border-${side}: ${Math.ceil(border.size)}px solid ${color2};`;
266761
266952
  return "";
266762
266953
  }).join(" ") };
266763
- }, TableHeader, TableRow, TableCell, FieldAnnotationView = class {
266954
+ }, TableHeader, parseLengthPx = (length$12) => {
266955
+ if (length$12 == null)
266956
+ return;
266957
+ if (typeof length$12 === "string") {
266958
+ const trimmed = length$12.trim().toLowerCase();
266959
+ if (!trimmed || trimmed === "auto")
266960
+ return;
266961
+ }
266962
+ const [value, unit] = parseSizeUnit(String(length$12));
266963
+ const numericValue = Number(value);
266964
+ return unit === "pt" ? halfPointToPixels(numericValue) : numericValue;
266965
+ }, parseExplicitRowHeight = (element3) => {
266966
+ const fromHeightStyle = parseLengthPx(element3?.style?.height);
266967
+ if (fromHeightStyle != null)
266968
+ return fromHeightStyle;
266969
+ const fromMinHeightStyle = parseLengthPx(element3?.style?.minHeight);
266970
+ if (fromMinHeightStyle != null)
266971
+ return fromMinHeightStyle;
266972
+ if (element3?.hasAttribute?.("height")) {
266973
+ const fromHeightAttr = parseLengthPx(element3.getAttribute("height"));
266974
+ if (fromHeightAttr != null)
266975
+ return fromHeightAttr;
266976
+ }
266977
+ }, parseTallestCellHeight = (element3) => {
266978
+ const cells = element3?.querySelectorAll?.("td,th");
266979
+ if (!cells?.length)
266980
+ return;
266981
+ let maxCellHeight;
266982
+ for (const cellNode of Array.from(cells)) {
266983
+ const cell2 = cellNode;
266984
+ const fromCellHeight = parseLengthPx(cell2?.style?.height);
266985
+ const fromCellMinHeight = parseLengthPx(cell2?.style?.minHeight);
266986
+ const fromCellHeightAttr = cell2?.hasAttribute?.("height") ? parseLengthPx(cell2.getAttribute("height")) : undefined;
266987
+ const candidate = fromCellHeight ?? fromCellMinHeight ?? fromCellHeightAttr;
266988
+ if (candidate == null)
266989
+ continue;
266990
+ if (maxCellHeight == null || candidate > maxCellHeight)
266991
+ maxCellHeight = candidate;
266992
+ }
266993
+ return maxCellHeight;
266994
+ }, parseRowHeight = (element3) => {
266995
+ return parseExplicitRowHeight(element3) ?? parseTallestCellHeight(element3);
266996
+ }, TableRow, TableCell, FieldAnnotationView = class {
266764
266997
  editor;
266765
266998
  node;
266766
266999
  decorations;
@@ -276464,13 +276697,21 @@ var Node$13 = class Node$14 {
276464
276697
  const cellBounds = getTableCellGridBounds(cellPosition);
276465
276698
  const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
276466
276699
  const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
276467
- if (hasExplicitBorders)
276700
+ if (hasExplicitBorders) {
276701
+ if (cellSpacingPx === 0)
276702
+ return {
276703
+ top: resolveTableBorderValue(cellBorders.top, touchesTopBoundary ? tableBorders.top : tableBorders.insideH),
276704
+ right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cellBorders.right, tableBorders.right) : undefined,
276705
+ bottom: touchesBottomBoundary ? resolveTableBorderValue(cellBorders.bottom, tableBorders.bottom) : undefined,
276706
+ left: resolveTableBorderValue(cellBorders.left, cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV)
276707
+ };
276468
276708
  return {
276469
276709
  top: resolveTableBorderValue(cellBorders.top, touchesTopBoundary ? tableBorders.top : tableBorders.insideH),
276470
276710
  right: resolveTableBorderValue(cellBorders.right, cellBounds.touchesRightEdge ? tableBorders.right : undefined),
276471
276711
  bottom: resolveTableBorderValue(cellBorders.bottom, touchesBottomBoundary ? tableBorders.bottom : undefined),
276472
276712
  left: resolveTableBorderValue(cellBorders.left, cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV)
276473
276713
  };
276714
+ }
276474
276715
  if (cellSpacingPx > 0) {
276475
276716
  const interiorBorders = {
276476
276717
  top: touchesTopBoundary ? undefined : borderValueToSpec(tableBorders.insideH),
@@ -287067,18 +287308,18 @@ var Node$13 = class Node$14 {
287067
287308
  return;
287068
287309
  console.log(...args$1);
287069
287310
  }, 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;
287070
- var init_src_BzK2Ejl0_es = __esm(() => {
287311
+ var init_src_CX93tpZZ_es = __esm(() => {
287071
287312
  init_rolldown_runtime_Bg48TavK_es();
287072
- init_SuperConverter_tT_4c8Ha_es();
287313
+ init_SuperConverter_DKPcCGTm_es();
287073
287314
  init_jszip_C49i9kUs_es();
287074
287315
  init_uuid_qzgm05fK_es();
287075
- init_create_headless_toolbar_y2bgJGCh_es();
287076
- init_constants_5yyN6FZg_es();
287316
+ init_create_headless_toolbar_BTSQjUTS_es();
287317
+ init_constants_CGhJRd87_es();
287077
287318
  init_dist_B8HfvhaK_es();
287078
287319
  init_unified_Dsuw2be5_es();
287079
287320
  init_remark_gfm_BhnWr3yf_es();
287080
287321
  init_remark_stringify_6MMJfY0k_es();
287081
- init_DocxZipper_UDBAhMbp_es();
287322
+ init_DocxZipper_CaIWmehq_es();
287082
287323
  init__plugin_vue_export_helper_HmhZBO0u_es();
287083
287324
  init_eventemitter3_BdNugZrm_es();
287084
287325
  init_errors_CtyzHiH4_es();
@@ -291694,6 +291935,19 @@ ${err.toString()}`);
291694
291935
  })) };
291695
291936
  }
291696
291937
  });
291938
+ STYLE_TOKEN_SET = new Set([
291939
+ "none",
291940
+ "hidden",
291941
+ "dotted",
291942
+ "dashed",
291943
+ "solid",
291944
+ "double",
291945
+ "groove",
291946
+ "ridge",
291947
+ "inset",
291948
+ "outset"
291949
+ ]);
291950
+ STYLE_TOKEN_PATTERN = Array.from(STYLE_TOKEN_SET).join("|");
291697
291951
  TableHeader = Node$13.create({
291698
291952
  name: "tableHeader",
291699
291953
  content: "block+",
@@ -291726,36 +291980,51 @@ ${err.toString()}`);
291726
291980
  return { "data-colwidth": attrs.colwidth.join(",") };
291727
291981
  }
291728
291982
  },
291729
- background: { renderDOM({ background }) {
291730
- if (!background)
291731
- return {};
291732
- const { color: color2 } = background || {};
291733
- return { style: `background-color: ${color2 ? `#${color2}` : "transparent"}` };
291734
- } },
291735
- verticalAlign: { renderDOM({ verticalAlign }) {
291736
- if (!verticalAlign)
291737
- return {};
291738
- return { style: `vertical-align: ${verticalAlign}` };
291739
- } },
291740
- cellMargins: { renderDOM({ cellMargins, borders }) {
291741
- if (!cellMargins)
291742
- return {};
291743
- return { style: [
291744
- "top",
291745
- "right",
291746
- "bottom",
291747
- "left"
291748
- ].map((side) => {
291749
- const margin = cellMargins?.[side] ?? 0;
291750
- const border = borders?.[side];
291751
- const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
291752
- if (margin)
291753
- return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
291754
- return "";
291755
- }).join(" ") };
291756
- } },
291983
+ background: {
291984
+ parseDOM: (element3) => {
291985
+ const color2 = cssColorToHex(element3.style?.backgroundColor);
291986
+ if (!color2)
291987
+ return null;
291988
+ return { color: color2.replace(/^#/, "") };
291989
+ },
291990
+ renderDOM({ background }) {
291991
+ if (!background)
291992
+ return {};
291993
+ const { color: color2 } = background || {};
291994
+ return { style: `background-color: ${color2 ? `#${color2}` : "transparent"}` };
291995
+ }
291996
+ },
291997
+ verticalAlign: {
291998
+ parseDOM: parseCellVerticalAlignFromStyle,
291999
+ renderDOM({ verticalAlign }) {
292000
+ if (!verticalAlign)
292001
+ return {};
292002
+ return { style: `vertical-align: ${verticalAlign}` };
292003
+ }
292004
+ },
292005
+ cellMargins: {
292006
+ parseDOM: (element3) => parseCellMargins(element3),
292007
+ renderDOM({ cellMargins, borders }) {
292008
+ if (!cellMargins)
292009
+ return {};
292010
+ return { style: [
292011
+ "top",
292012
+ "right",
292013
+ "bottom",
292014
+ "left"
292015
+ ].map((side) => {
292016
+ const margin = cellMargins?.[side] ?? 0;
292017
+ const border = borders?.[side];
292018
+ const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
292019
+ if (margin)
292020
+ return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
292021
+ return "";
292022
+ }).join(" ") };
292023
+ }
292024
+ },
291757
292025
  borders: {
291758
292026
  default: null,
292027
+ parseDOM: (element3) => parseCellBorders(element3),
291759
292028
  renderDOM: ({ borders }) => {
291760
292029
  if (!borders)
291761
292030
  return {};
@@ -291835,7 +292104,18 @@ ${err.toString()}`);
291835
292104
  return { "data-cant-split": "true" };
291836
292105
  }
291837
292106
  },
291838
- tableRowProperties: { rendered: false },
292107
+ tableRowProperties: {
292108
+ rendered: false,
292109
+ parseDOM: (element3) => {
292110
+ const parsedHeightPx = parseRowHeight(element3);
292111
+ if (parsedHeightPx == null)
292112
+ return;
292113
+ return { rowHeight: {
292114
+ value: pixelsToTwips(parsedHeightPx),
292115
+ rule: "atLeast"
292116
+ } };
292117
+ }
292118
+ },
291839
292119
  rsidDel: { rendered: false },
291840
292120
  rsidR: { rendered: false },
291841
292121
  rsidRPr: { rendered: false },
@@ -291899,36 +292179,51 @@ ${err.toString()}`);
291899
292179
  return { "data-colwidth": attrs.colwidth.join(",") };
291900
292180
  }
291901
292181
  },
291902
- background: { renderDOM({ background }) {
291903
- if (!background)
291904
- return {};
291905
- const { color: color2 } = background || {};
291906
- return { style: `background-color: ${color2 ? `#${color2}` : "transparent"}` };
291907
- } },
291908
- verticalAlign: { renderDOM({ verticalAlign }) {
291909
- if (!verticalAlign)
291910
- return {};
291911
- return { style: `vertical-align: ${verticalAlign}` };
291912
- } },
291913
- cellMargins: { renderDOM({ cellMargins, borders }) {
291914
- if (!cellMargins)
291915
- return {};
291916
- return { style: [
291917
- "top",
291918
- "right",
291919
- "bottom",
291920
- "left"
291921
- ].map((side) => {
291922
- const margin = cellMargins?.[side] ?? 0;
291923
- const border = borders?.[side];
291924
- const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
291925
- if (margin)
291926
- return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
291927
- return "";
291928
- }).join(" ") };
291929
- } },
292182
+ background: {
292183
+ parseDOM: (element3) => {
292184
+ const color2 = cssColorToHex(element3.style?.backgroundColor);
292185
+ if (!color2)
292186
+ return null;
292187
+ return { color: color2.replace(/^#/, "") };
292188
+ },
292189
+ renderDOM({ background }) {
292190
+ if (!background)
292191
+ return {};
292192
+ const { color: color2 } = background || {};
292193
+ return { style: `background-color: ${color2 ? `#${color2}` : "transparent"}` };
292194
+ }
292195
+ },
292196
+ verticalAlign: {
292197
+ parseDOM: parseCellVerticalAlignFromStyle,
292198
+ renderDOM({ verticalAlign }) {
292199
+ if (!verticalAlign)
292200
+ return {};
292201
+ return { style: `vertical-align: ${verticalAlign}` };
292202
+ }
292203
+ },
292204
+ cellMargins: {
292205
+ parseDOM: (element3) => parseCellMargins(element3),
292206
+ renderDOM({ cellMargins, borders }) {
292207
+ if (!cellMargins)
292208
+ return {};
292209
+ return { style: [
292210
+ "top",
292211
+ "right",
292212
+ "bottom",
292213
+ "left"
292214
+ ].map((side) => {
292215
+ const margin = cellMargins?.[side] ?? 0;
292216
+ const border = borders?.[side];
292217
+ const borderSize = border && border.val !== "none" ? Math.ceil(border.size) : 0;
292218
+ if (margin)
292219
+ return `padding-${side}: ${Math.max(0, margin - borderSize)}px;`;
292220
+ return "";
292221
+ }).join(" ") };
292222
+ }
292223
+ },
291930
292224
  borders: {
291931
292225
  default: null,
292226
+ parseDOM: (element3) => parseCellBorders(element3),
291932
292227
  renderDOM: ({ borders }) => {
291933
292228
  if (!borders)
291934
292229
  return {};
@@ -321587,15 +321882,15 @@ var init_zipper_DbkgrypV_es = __esm(() => {
321587
321882
 
321588
321883
  // ../../packages/superdoc/dist/super-editor.es.js
321589
321884
  var init_super_editor_es = __esm(() => {
321590
- init_src_BzK2Ejl0_es();
321591
- init_SuperConverter_tT_4c8Ha_es();
321885
+ init_src_CX93tpZZ_es();
321886
+ init_SuperConverter_DKPcCGTm_es();
321592
321887
  init_jszip_C49i9kUs_es();
321593
321888
  init_xml_js_CqGKpaft_es();
321594
- init_create_headless_toolbar_y2bgJGCh_es();
321595
- init_constants_5yyN6FZg_es();
321889
+ init_create_headless_toolbar_BTSQjUTS_es();
321890
+ init_constants_CGhJRd87_es();
321596
321891
  init_dist_B8HfvhaK_es();
321597
321892
  init_unified_Dsuw2be5_es();
321598
- init_DocxZipper_UDBAhMbp_es();
321893
+ init_DocxZipper_CaIWmehq_es();
321599
321894
  init_eventemitter3_BdNugZrm_es();
321600
321895
  init_errors_CtyzHiH4_es();
321601
321896
  init_zipper_DbkgrypV_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.5.0-next.67",
3
+ "version": "0.5.0-next.69",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,19 +26,19 @@
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
28
  "@superdoc/pm-adapter": "0.0.0",
29
- "superdoc": "1.25.0",
30
- "@superdoc/super-editor": "0.0.1"
29
+ "@superdoc/super-editor": "0.0.1",
30
+ "superdoc": "1.25.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.67",
38
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.67",
39
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.67",
40
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.67",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.67"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.69",
38
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.69",
39
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.69",
40
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.69",
41
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.69"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",