@superdoc-dev/cli 0.3.0-next.42 → 0.3.0-next.43

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 +94 -21
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -39922,7 +39922,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
39922
39922
  emptyOptions2 = {};
39923
39923
  });
39924
39924
 
39925
- // ../../packages/superdoc/dist/chunks/SuperConverter-oKnAIRIw.es.js
39925
+ // ../../packages/superdoc/dist/chunks/SuperConverter--IVMRugL.es.js
39926
39926
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
39927
39927
  const fieldValue = extension$1.config[field];
39928
39928
  if (typeof fieldValue === "function")
@@ -48771,18 +48771,17 @@ function handleTableCellNode({ params, node: node3, table, row, tableProperties,
48771
48771
  const rows = table.elements.filter((el) => el.name === "w:tr");
48772
48772
  const currentRowIndex = rows.findIndex((r) => r === row);
48773
48773
  const remainingRows = rows.slice(currentRowIndex + 1);
48774
- let cellIndex = row.elements.filter((el) => el.name === "w:tc").findIndex((el) => el === node3);
48775
48774
  let rowspan = 1;
48775
+ const startColumn = Number.isFinite(columnIndex) ? columnIndex : 0;
48776
48776
  for (let remainingRow of remainingRows) {
48777
- const firstCell = remainingRow.elements.findIndex((el) => el.name === "w:tc");
48778
- const cellAtIndex = remainingRow.elements[firstCell + cellIndex];
48779
- if (!cellAtIndex)
48777
+ const cellAtColumn = findTableCellAtColumn(remainingRow, startColumn);
48778
+ if (!cellAtColumn)
48780
48779
  break;
48781
- const vMerge = getTableCellVMerge(cellAtIndex);
48780
+ const vMerge = getTableCellVMerge(cellAtColumn);
48782
48781
  if (!vMerge || vMerge === "restart")
48783
48782
  break;
48784
48783
  rowspan++;
48785
- remainingRow.elements.splice(firstCell + cellIndex, 1);
48784
+ markTableCellAsVMergeConsumed(cellAtColumn);
48786
48785
  }
48787
48786
  attributes["rowspan"] = rowspan;
48788
48787
  }
@@ -72870,6 +72869,29 @@ var isRegExp = (value) => {
72870
72869
  if (!vMerge)
72871
72870
  return null;
72872
72871
  return vMerge.attributes?.["w:val"] || "continue";
72872
+ }, getGridBefore = (row) => {
72873
+ const raw = row.elements?.find((el) => el.name === "w:trPr")?.elements?.find((el) => el.name === "w:gridBefore")?.attributes?.["w:val"];
72874
+ const value = typeof raw === "string" ? parseInt(raw, 10) : raw;
72875
+ return Number.isFinite(value) && value > 0 ? value : 0;
72876
+ }, getTableCellGridSpan = (node3) => {
72877
+ if (!node3 || node3.name !== "w:tc")
72878
+ return 1;
72879
+ const raw = node3.elements?.find((el) => el.name === "w:tcPr")?.elements?.find((el) => el.name === "w:gridSpan")?.attributes?.["w:val"];
72880
+ const value = typeof raw === "string" ? parseInt(raw, 10) : raw;
72881
+ return Number.isFinite(value) && value > 0 ? value : 1;
72882
+ }, findTableCellAtColumn = (row, targetColumn) => {
72883
+ const cells = row.elements?.filter((el) => el.name === "w:tc") ?? [];
72884
+ let currentColumn = getGridBefore(row);
72885
+ for (const cell of cells) {
72886
+ const colSpan = getTableCellGridSpan(cell);
72887
+ if (targetColumn >= currentColumn && targetColumn < currentColumn + colSpan)
72888
+ return cell._vMergeConsumed ? null : cell;
72889
+ currentColumn += colSpan;
72890
+ }
72891
+ return null;
72892
+ }, markTableCellAsVMergeConsumed = (node3) => {
72893
+ if (node3?.name === "w:tc")
72894
+ node3._vMergeConsumed = true;
72873
72895
  }, getTableCellMargins = (inlineMargins, referencedStyles) => {
72874
72896
  const { cellMargins = {} } = referencedStyles;
72875
72897
  return [
@@ -73004,6 +73026,8 @@ var isRegExp = (value) => {
73004
73026
  cellNodes?.forEach((node3) => {
73005
73027
  skipOccupiedColumns();
73006
73028
  const startColumn = currentColumnIndex;
73029
+ if (node3._vMergeConsumed)
73030
+ return;
73007
73031
  const columnWidth = gridColumnWidths?.[startColumn] || null;
73008
73032
  const result = translator$5.encode({
73009
73033
  ...params,
@@ -85997,7 +86021,7 @@ var isRegExp = (value) => {
85997
86021
  state.kern = kernNode.attributes["w:val"];
85998
86022
  }
85999
86023
  }, SuperConverter;
86000
- var init_SuperConverter_oKnAIRIw_es = __esm(() => {
86024
+ var init_SuperConverter_IVMRugL_es = __esm(() => {
86001
86025
  init_rolldown_runtime_B2q5OVn9_es();
86002
86026
  init_jszip_ChlR43oI_es();
86003
86027
  init_xml_js_BtmJ6bNs_es();
@@ -148813,7 +148837,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
148813
148837
  init_remark_gfm_z_sDF4ss_es();
148814
148838
  });
148815
148839
 
148816
- // ../../packages/superdoc/dist/chunks/src-CLe3UbDE.es.js
148840
+ // ../../packages/superdoc/dist/chunks/src-ofVoy7QC.es.js
148817
148841
  function deleteProps(obj, propOrProps) {
148818
148842
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
148819
148843
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -192255,17 +192279,20 @@ function extractDefaultFontProperties(converterContext, paragraphProperties) {
192255
192279
  defaultSize: defaultRunAttrs.fontSize
192256
192280
  };
192257
192281
  }
192258
- function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesConfig, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, converters: converters$1, converterContext, enableComments = true, stableBlockId }) {
192282
+ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesConfig, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, converters: converters$1, converterContext, enableComments = true, stableBlockId, previousParagraphFont }) {
192259
192283
  const baseBlockId = stableBlockId ?? nextBlockId("paragraph");
192260
192284
  let inlineBlockCounter = 0;
192261
192285
  const stableNextBlockId = stableBlockId ? (prefix2) => `${stableBlockId}-${prefix2}-${inlineBlockCounter++}` : nextBlockId;
192262
192286
  const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
192263
- const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext);
192287
+ const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext, previousParagraphFont);
192264
192288
  const blocks2 = [];
192265
192289
  const paraAttrs = para.attrs ?? {};
192266
192290
  const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : undefined;
192267
192291
  const isSectPrMarker = Boolean(rawParagraphProps?.sectPr) || paraAttrs.pageBreakSource === "sectPr";
192268
- const { defaultFont, defaultSize } = extractDefaultFontProperties(converterContext, resolvedParagraphProperties);
192292
+ const extracted = extractDefaultFontProperties(converterContext, resolvedParagraphProperties);
192293
+ const usePreviousFont = previousParagraphFont != null && resolvedParagraphProperties.numberingProperties != null && !hasExplicitParagraphRunProperties(paragraphProps);
192294
+ const defaultFont = usePreviousFont && previousParagraphFont.fontFamily ? previousParagraphFont.fontFamily : extracted.defaultFont;
192295
+ const defaultSize = usePreviousFont && previousParagraphFont.fontSize ? previousParagraphFont.fontSize : extracted.defaultSize;
192269
192296
  if (paragraphAttrs.pageBreakBefore)
192270
192297
  blocks2.push({
192271
192298
  kind: "pageBreak",
@@ -192479,6 +192506,24 @@ function paragraphToFlowBlocks({ para, nextBlockId, positions, trackedChangesCon
192479
192506
  });
192480
192507
  return processedBlocks;
192481
192508
  }
192509
+ function getLastParagraphFont(blocks2) {
192510
+ for (let i4 = blocks2.length - 1;i4 >= 0; i4--) {
192511
+ const block = blocks2[i4];
192512
+ if (block.kind === "paragraph") {
192513
+ const firstRun = block.runs?.[0];
192514
+ if (!firstRun)
192515
+ continue;
192516
+ const run2 = firstRun;
192517
+ const fontFamily = typeof run2.fontFamily === "string" ? run2.fontFamily.trim() : "";
192518
+ const fontSize = typeof run2.fontSize === "number" && Number.isFinite(run2.fontSize) ? run2.fontSize : NaN;
192519
+ if (fontFamily.length > 0 && fontSize > 0)
192520
+ return {
192521
+ fontFamily,
192522
+ fontSize
192523
+ };
192524
+ }
192525
+ }
192526
+ }
192482
192527
  function handleParagraphNode2(node3, context) {
192483
192528
  const { blocks: blocks2, recordBlockKind, nextBlockId, blockIdPrefix = "", positions, trackedChangesConfig, bookmarks, hyperlinkConfig, sectionState, converters: converters$1, converterContext, themeColors, flowBlockCache, enableComments } = context;
192484
192529
  const { ranges: sectionRanges, currentSectionIndex, currentParagraphIndex } = sectionState;
@@ -192521,7 +192566,8 @@ function handleParagraphNode2(node3, context) {
192521
192566
  converters: converters$1,
192522
192567
  converterContext,
192523
192568
  enableComments,
192524
- stableBlockId: prefixedStableId
192569
+ stableBlockId: prefixedStableId,
192570
+ previousParagraphFont: getLastParagraphFont(blocks2)
192525
192571
  });
192526
192572
  applyTrackedGhostListAdjustments(node3, paragraphBlocks$1, context);
192527
192573
  paragraphBlocks$1.forEach((block) => {
@@ -192532,6 +192578,7 @@ function handleParagraphNode2(node3, context) {
192532
192578
  sectionState.currentParagraphIndex++;
192533
192579
  return;
192534
192580
  }
192581
+ const previousParagraphFont = getLastParagraphFont(blocks2);
192535
192582
  const paragraphBlocks = paragraphToFlowBlocks$1({
192536
192583
  para: node3,
192537
192584
  nextBlockId,
@@ -192543,7 +192590,8 @@ function handleParagraphNode2(node3, context) {
192543
192590
  converters: converters$1,
192544
192591
  converterContext,
192545
192592
  enableComments,
192546
- stableBlockId: prefixedStableId ?? undefined
192593
+ stableBlockId: prefixedStableId ?? undefined,
192594
+ previousParagraphFont
192547
192595
  });
192548
192596
  applyTrackedGhostListAdjustments(node3, paragraphBlocks, context);
192549
192597
  paragraphBlocks.forEach((block) => {
@@ -216381,6 +216429,18 @@ var Node$13 = class Node$14 {
216381
216429
  if (value?.numId === 0)
216382
216430
  return;
216383
216431
  return value;
216432
+ }, TRACKED_CHANGE_KEYS, hasExplicitParagraphRunProperties = (paragraphProperties) => {
216433
+ if (paragraphProperties?.runProperties == null)
216434
+ return false;
216435
+ return Object.keys(paragraphProperties.runProperties).some((key$1) => !TRACKED_CHANGE_KEYS.has(key$1));
216436
+ }, applyParagraphFontFallback = (runAttrs, previousParagraphFont) => {
216437
+ if (!previousParagraphFont)
216438
+ return runAttrs;
216439
+ return {
216440
+ ...runAttrs,
216441
+ fontFamily: previousParagraphFont.fontFamily ?? runAttrs.fontFamily,
216442
+ fontSize: previousParagraphFont.fontSize ?? runAttrs.fontSize
216443
+ };
216384
216444
  }, normalizeDropCap = (framePr, para, converterContext) => {
216385
216445
  if (!framePr || !framePr.dropCap || framePr.dropCap === "none")
216386
216446
  return;
@@ -216425,7 +216485,7 @@ var Node$13 = class Node$14 {
216425
216485
  color: runAttrs.color,
216426
216486
  position: resolvedRunProperties.position != null ? ptToPx(resolvedRunProperties.position / 2) : undefined
216427
216487
  };
216428
- }, computeParagraphAttrs = (para, converterContext) => {
216488
+ }, computeParagraphAttrs = (para, converterContext, previousParagraphFont) => {
216429
216489
  const attrs = para.attrs ?? {};
216430
216490
  const paragraphProperties = attrs.paragraphProperties ?? {};
216431
216491
  let resolvedParagraphProperties;
@@ -216466,12 +216526,24 @@ var Node$13 = class Node$14 {
216466
216526
  pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
216467
216527
  direction: resolvedParagraphProperties.rightToLeft ? "rtl" : undefined
216468
216528
  };
216469
- if (normalizedNumberingProperties && normalizedListRendering)
216529
+ if (normalizedNumberingProperties && normalizedListRendering) {
216530
+ const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
216531
+ let markerFontFallback;
216532
+ if (!hasExplicitParagraphRunProperties(paragraphProperties) && previousParagraphFont) {
216533
+ const numProps = paragraphProperties.numberingProperties;
216534
+ const numId = numProps?.numId;
216535
+ const ilvl = numProps?.ilvl ?? 0;
216536
+ markerFontFallback = {
216537
+ fontFamily: (numId != null && numId !== 0 ? getNumberingProperties$1("runProperties", converterContext, ilvl, numId) : {}).fontFamily != null ? undefined : previousParagraphFont.fontFamily,
216538
+ fontSize: previousParagraphFont.fontSize
216539
+ };
216540
+ }
216470
216541
  paragraphAttrs.wordLayout = computeWordParagraphLayout({
216471
216542
  paragraph: paragraphAttrs,
216472
216543
  listRenderingAttrs: normalizedListRendering,
216473
- markerRun: computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext)
216544
+ markerRun: applyParagraphFontFallback(markerRunAttrs, markerFontFallback)
216474
216545
  });
216546
+ }
216475
216547
  return {
216476
216548
  paragraphAttrs,
216477
216549
  resolvedParagraphProperties
@@ -229021,9 +229093,9 @@ var Node$13 = class Node$14 {
229021
229093
  return false;
229022
229094
  return Boolean(checker(attrs));
229023
229095
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
229024
- var init_src_CLe3UbDE_es = __esm(() => {
229096
+ var init_src_ofVoy7QC_es = __esm(() => {
229025
229097
  init_rolldown_runtime_B2q5OVn9_es();
229026
- init_SuperConverter_oKnAIRIw_es();
229098
+ init_SuperConverter_IVMRugL_es();
229027
229099
  init_jszip_ChlR43oI_es();
229028
229100
  init_uuid_qzgm05fK_es();
229029
229101
  init_constants_ep1_Gwqi_es();
@@ -246069,6 +246141,7 @@ function print() { __p += __j.call(arguments, '') }
246069
246141
  "doubleWave"
246070
246142
  ]);
246071
246143
  PIXELS_PER_TWIP = 1 / Math.round(1440 / 96);
246144
+ TRACKED_CHANGE_KEYS = new Set(["trackInsert", "trackDelete"]);
246072
246145
  VALID_LINK_TARGETS = new Set([
246073
246146
  "_blank",
246074
246147
  "_self",
@@ -262356,8 +262429,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
262356
262429
 
262357
262430
  // ../../packages/superdoc/dist/super-editor.es.js
262358
262431
  var init_super_editor_es = __esm(() => {
262359
- init_src_CLe3UbDE_es();
262360
- init_SuperConverter_oKnAIRIw_es();
262432
+ init_src_ofVoy7QC_es();
262433
+ init_SuperConverter_IVMRugL_es();
262361
262434
  init_jszip_ChlR43oI_es();
262362
262435
  init_xml_js_BtmJ6bNs_es();
262363
262436
  init_constants_ep1_Gwqi_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.42",
3
+ "version": "0.3.0-next.43",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,9 +20,9 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
- "@superdoc/document-api": "0.0.1",
24
23
  "@superdoc/pm-adapter": "0.0.0",
25
24
  "@superdoc/super-editor": "0.0.1",
25
+ "@superdoc/document-api": "0.0.1",
26
26
  "superdoc": "1.20.0"
27
27
  },
28
28
  "module": "src/index.ts",
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.42",
34
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.42",
35
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.42",
36
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.42",
37
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.42"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.43",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.43",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.43",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.43",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.43"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",