@superdoc-dev/cli 0.2.0-next.118 → 0.2.0-next.119

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 +102 -10
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -134408,7 +134408,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
134408
134408
  init_remark_gfm_z_sDF4ss_es();
134409
134409
  });
134410
134410
 
134411
- // ../../packages/superdoc/dist/chunks/src-C1wprZky.es.js
134411
+ // ../../packages/superdoc/dist/chunks/src-Crr00svT.es.js
134412
134412
  function deleteProps(obj, propOrProps) {
134413
134413
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
134414
134414
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -170961,6 +170961,97 @@ async function measureTableBlock(block, constraints) {
170961
170961
  const columnWidth = Math.max(1, Math.floor(effectiveTargetWidth / maxCellCount));
170962
170962
  columnWidths = Array.from({ length: maxCellCount }, () => columnWidth);
170963
170963
  }
170964
+ const isFixedLayout = block.attrs?.tableLayout === "fixed";
170965
+ const gridLooksLikePlaceholder = columnWidths.reduce((a2, b$1) => a2 + b$1, 0) < maxWidth * 0.1;
170966
+ if (!isFixedLayout && gridLooksLikePlaceholder) {
170967
+ const gridColCount = columnWidths.length;
170968
+ const maxContentWidths = new Array(gridColCount).fill(0);
170969
+ const autoFitRowspanTracker = new Array(gridColCount).fill(0);
170970
+ for (const row2 of block.rows) {
170971
+ let colIndex = 0;
170972
+ for (const cell2 of row2.cells) {
170973
+ const colspan = cell2.colSpan ?? 1;
170974
+ const rowspan = cell2.rowSpan ?? 1;
170975
+ while (colIndex < gridColCount && autoFitRowspanTracker[colIndex] > 0) {
170976
+ autoFitRowspanTracker[colIndex]--;
170977
+ colIndex++;
170978
+ }
170979
+ if (colIndex >= gridColCount)
170980
+ break;
170981
+ if (colspan === 1) {
170982
+ const cellPadding = cell2.attrs?.padding ?? DEFAULT_CELL_PADDING$1;
170983
+ const paddingH = (cellPadding.left ?? 4) + (cellPadding.right ?? 4);
170984
+ const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
170985
+ let cellMaxWidth = 0;
170986
+ for (const cellBlock of cellBlocks) {
170987
+ const maxMeasure = await measureBlock(cellBlock, {
170988
+ maxWidth: 99999,
170989
+ maxHeight: Infinity
170990
+ });
170991
+ let blockMaxWidth = 0;
170992
+ if (maxMeasure.kind === "paragraph") {
170993
+ for (const line of maxMeasure.lines)
170994
+ if (line.width > blockMaxWidth)
170995
+ blockMaxWidth = line.width;
170996
+ } else if (maxMeasure.kind === "image" || maxMeasure.kind === "drawing")
170997
+ blockMaxWidth = maxMeasure.width;
170998
+ else if (maxMeasure.kind === "table")
170999
+ blockMaxWidth = maxMeasure.totalWidth;
171000
+ else if (maxMeasure.kind === "list") {
171001
+ for (const item of maxMeasure.items)
171002
+ if (item.paragraph) {
171003
+ const gutterWidth = (item.indentLeft ?? 0) + (item.markerWidth ?? 0);
171004
+ for (const line of item.paragraph.lines) {
171005
+ const lineTotal = gutterWidth + line.width;
171006
+ if (lineTotal > blockMaxWidth)
171007
+ blockMaxWidth = lineTotal;
171008
+ }
171009
+ }
171010
+ }
171011
+ if (blockMaxWidth > cellMaxWidth)
171012
+ cellMaxWidth = blockMaxWidth;
171013
+ }
171014
+ const totalWidth$1 = cellMaxWidth + paddingH;
171015
+ if (totalWidth$1 > maxContentWidths[colIndex])
171016
+ maxContentWidths[colIndex] = totalWidth$1;
171017
+ }
171018
+ if (rowspan > 1)
171019
+ for (let c = 0;c < colspan && colIndex + c < gridColCount; c++)
171020
+ autoFitRowspanTracker[colIndex + c] = rowspan - 1;
171021
+ colIndex += colspan;
171022
+ }
171023
+ for (let col = colIndex;col < gridColCount; col++)
171024
+ if (autoFitRowspanTracker[col] > 0)
171025
+ autoFitRowspanTracker[col]--;
171026
+ }
171027
+ const contentTotal = maxContentWidths.reduce((a2, b$1) => a2 + b$1, 0);
171028
+ if (contentTotal > 0)
171029
+ if (contentTotal <= maxWidth) {
171030
+ for (let i$1 = 0;i$1 < gridColCount; i$1++)
171031
+ if (maxContentWidths[i$1] > columnWidths[i$1])
171032
+ columnWidths[i$1] = maxContentWidths[i$1];
171033
+ const expandedTotal = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
171034
+ if (expandedTotal > maxWidth && gridColCount > 0) {
171035
+ const scale = maxWidth / expandedTotal;
171036
+ for (let i$1 = 0;i$1 < gridColCount; i$1++)
171037
+ columnWidths[i$1] = Math.max(1, Math.round(columnWidths[i$1] * scale));
171038
+ const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
171039
+ if (scaledSum !== maxWidth) {
171040
+ const diff = maxWidth - scaledSum;
171041
+ columnWidths[gridColCount - 1] = Math.max(1, columnWidths[gridColCount - 1] + diff);
171042
+ }
171043
+ }
171044
+ } else {
171045
+ const scale = maxWidth / contentTotal;
171046
+ for (let i$1 = 0;i$1 < gridColCount; i$1++)
171047
+ columnWidths[i$1] = Math.max(1, Math.round(maxContentWidths[i$1] * scale));
171048
+ const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
171049
+ if (scaledSum !== maxWidth && gridColCount > 0) {
171050
+ const diff = maxWidth - scaledSum;
171051
+ columnWidths[gridColCount - 1] = Math.max(1, columnWidths[gridColCount - 1] + diff);
171052
+ }
171053
+ }
171054
+ }
170964
171055
  const gridColumnCount = columnWidths.length;
170965
171056
  const calculateCellWidth = (startCol, colspan) => {
170966
171057
  let width = 0;
@@ -170989,12 +171080,7 @@ async function measureTableBlock(block, constraints) {
170989
171080
  if (rowspan > 1)
170990
171081
  for (let c = 0;c < colspan && gridColIndex + c < gridColumnCount; c++)
170991
171082
  rowspanTracker[gridColIndex + c] = rowspan - 1;
170992
- const cellPadding = cell2.attrs?.padding ?? {
170993
- top: 0,
170994
- left: 4,
170995
- right: 4,
170996
- bottom: 0
170997
- };
171083
+ const cellPadding = cell2.attrs?.padding ?? DEFAULT_CELL_PADDING$1;
170998
171084
  const paddingTop = cellPadding.top ?? 0;
170999
171085
  const paddingBottom = cellPadding.bottom ?? 0;
171000
171086
  const paddingLeft = cellPadding.left ?? 4;
@@ -200710,7 +200796,7 @@ var Node$13 = class Node$14 {
200710
200796
  nativeSelectionStylesInjected = true;
200711
200797
  }, gradientIdCounter = 0, EMUS_PER_INCH = 914400, maxSize = 5000, cache$1, makeKey = (text5, font, letterSpacing) => {
200712
200798
  return `${text5}|${font}|${letterSpacing || 0}`;
200713
- }, fontMetricsCache, MAX_CACHE_SIZE$1 = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", computeTabStops, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$1, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1), DEFAULT_TAB_INTERVAL_PX$1, TAB_EPSILON$1 = 0.1, DEFAULT_DECIMAL_SEPARATOR$1 = ".", ALLOWED_TAB_VALS, FIELD_ANNOTATION_PILL_PADDING = 8, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, FIELD_ANNOTATION_VERTICAL_PADDING = 6, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize$1 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
200799
+ }, fontMetricsCache, MAX_CACHE_SIZE$1 = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", computeTabStops, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$1, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1), DEFAULT_TAB_INTERVAL_PX$1, TAB_EPSILON$1 = 0.1, DEFAULT_CELL_PADDING$1, DEFAULT_DECIMAL_SEPARATOR$1 = ".", ALLOWED_TAB_VALS, FIELD_ANNOTATION_PILL_PADDING = 8, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, FIELD_ANNOTATION_VERTICAL_PADDING = 6, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize$1 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
200714
200800
  if (isValidFontSize(value))
200715
200801
  return value;
200716
200802
  if (typeof value === "string") {
@@ -216436,7 +216522,7 @@ var Node$13 = class Node$14 {
216436
216522
  return false;
216437
216523
  return Boolean(checker(attrs));
216438
216524
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
216439
- var init_src_C1wprZky_es = __esm(() => {
216525
+ var init_src_Crr00svT_es = __esm(() => {
216440
216526
  init_rolldown_runtime_B2q5OVn9_es();
216441
216527
  init_SuperConverter_BBGfKYpx_es();
216442
216528
  init_jszip_ChlR43oI_es();
@@ -230718,6 +230804,12 @@ function print() { __p += __j.call(arguments, '') }
230718
230804
  };
230719
230805
  TWIPS_PER_PX$1 = 1440 / 96;
230720
230806
  DEFAULT_TAB_INTERVAL_PX$1 = twipsToPx$2(DEFAULT_TAB_INTERVAL_TWIPS$2);
230807
+ DEFAULT_CELL_PADDING$1 = {
230808
+ top: 0,
230809
+ left: 4,
230810
+ right: 4,
230811
+ bottom: 0
230812
+ };
230721
230813
  ALLOWED_TAB_VALS = new Set([
230722
230814
  "start",
230723
230815
  "center",
@@ -250016,7 +250108,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
250016
250108
 
250017
250109
  // ../../packages/superdoc/dist/super-editor.es.js
250018
250110
  var init_super_editor_es = __esm(() => {
250019
- init_src_C1wprZky_es();
250111
+ init_src_Crr00svT_es();
250020
250112
  init_SuperConverter_BBGfKYpx_es();
250021
250113
  init_jszip_ChlR43oI_es();
250022
250114
  init_xml_js_DLE8mr0n_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.118",
3
+ "version": "0.2.0-next.119",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,8 +21,8 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "@superdoc/pm-adapter": "0.0.0",
25
24
  "@superdoc/super-editor": "0.0.1",
25
+ "@superdoc/pm-adapter": "0.0.0",
26
26
  "superdoc": "1.18.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.2.0-next.118",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.118",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.118",
36
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.118",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.118"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.119",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.119",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.119",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.119",
37
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.119"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",