@superdoc-dev/cli 0.2.0-next.110 → 0.2.0-next.114

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 +212 -116
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -134600,9 +134600,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
134600
134600
  init_remark_gfm_z_sDF4ss_es();
134601
134601
  });
134602
134602
 
134603
- // ../../packages/superdoc/dist/chunks/src-CiSEdgP3.es.js
134604
- var exports_src_CiSEdgP3_es = {};
134605
- __export(exports_src_CiSEdgP3_es, {
134603
+ // ../../packages/superdoc/dist/chunks/src-D6a7JHkJ.es.js
134604
+ var exports_src_D6a7JHkJ_es = {};
134605
+ __export(exports_src_D6a7JHkJ_es, {
134606
134606
  zt: () => defineMark,
134607
134607
  z: () => cM,
134608
134608
  yt: () => Awareness,
@@ -178154,6 +178154,9 @@ function layoutDocument(blocks2, measures, options = {}) {
178154
178154
  if (block.kind === "pageBreak") {
178155
178155
  if (measure.kind !== "pageBreak")
178156
178156
  throw new Error(`layoutDocument: expected pageBreak measure for block ${block.id}`);
178157
+ const currentState = states[states.length - 1];
178158
+ if (shouldSkipRedundantPageBreakBefore(block, currentState))
178159
+ continue;
178157
178160
  paginator.startNewPage();
178158
178161
  continue;
178159
178162
  }
@@ -210221,7 +210224,7 @@ var Node$13 = class Node$14 {
210221
210224
  if (!Number.isFinite(value) || value < 0)
210222
210225
  return 0;
210223
210226
  return value;
210224
- }, COLUMN_MIN_WIDTH_PX = 25, COLUMN_MAX_WIDTH_PX = 200, ROW_MIN_HEIGHT_PX = 10, MIN_PARTIAL_ROW_HEIGHT = 20, ROW_HEIGHT_EPSILON = 0.1, DEFAULT_BALANCING_CONFIG, DEFAULT_PARAGRAPH_LINE_HEIGHT_PX = 20, SEMANTIC_PAGE_HEIGHT_PX = 1e6, DEFAULT_PAGE_SIZE$2, DEFAULT_MARGINS$2, COLUMN_EPSILON$1 = 0.0001, asBoolean = (value) => {
210227
+ }, COLUMN_MIN_WIDTH_PX = 25, COLUMN_MAX_WIDTH_PX = 200, ROW_MIN_HEIGHT_PX = 10, MIN_PARTIAL_ROW_HEIGHT = 20, ROW_HEIGHT_EPSILON = 0.1, DEFAULT_BALANCING_CONFIG, DEFAULT_PARAGRAPH_LINE_HEIGHT_PX = 20, SEMANTIC_PAGE_HEIGHT_PX = 1e6, DEFAULT_PAGE_SIZE$2, DEFAULT_MARGINS$2, COLUMN_EPSILON$1 = 0.0001, PAGE_START_EPSILON = 0.0001, asBoolean = (value) => {
210225
210228
  if (value === true || value === 1)
210226
210229
  return true;
210227
210230
  if (typeof value === "string") {
@@ -210229,6 +210232,12 @@ var Node$13 = class Node$14 {
210229
210232
  return normalized === "true" || normalized === "1" || normalized === "on";
210230
210233
  }
210231
210234
  return false;
210235
+ }, shouldSkipRedundantPageBreakBefore = (block, state) => {
210236
+ if (block.attrs?.source !== "pageBreakBefore")
210237
+ return false;
210238
+ if (!state)
210239
+ return true;
210240
+ return state.page.fragments.length === 0 && state.columnIndex === 0 && Math.abs(state.cursorY - state.topMargin) <= PAGE_START_EPSILON;
210232
210241
  }, layoutDebugEnabled$2, layoutLog = (...args$1) => {
210233
210242
  if (!layoutDebugEnabled$2)
210234
210243
  return;
@@ -210565,6 +210574,37 @@ var Node$13 = class Node$14 {
210565
210574
  else
210566
210575
  tabWidth = nextDefaultTabStop - currentPos;
210567
210576
  return tabWidth;
210577
+ }, normalizeSpan = (span) => {
210578
+ if (typeof span !== "number" || !Number.isFinite(span) || span < 1)
210579
+ return 1;
210580
+ return Math.floor(span);
210581
+ }, clampStartIndex = (index2, totalCount) => {
210582
+ if (totalCount <= 0)
210583
+ return 0;
210584
+ return Math.min(Math.max(0, index2), totalCount - 1);
210585
+ }, getExclusiveEndIndex = (startIndex, span, totalCount) => {
210586
+ if (totalCount <= 0)
210587
+ return 0;
210588
+ return Math.min(startIndex + span, totalCount);
210589
+ }, getTableCellGridBounds = (position4) => {
210590
+ const normalizedRowSpan = normalizeSpan(position4.rowSpan);
210591
+ const normalizedColSpan = normalizeSpan(position4.colSpan);
210592
+ const startRow = clampStartIndex(position4.rowIndex, position4.totalRows);
210593
+ const startCol = clampStartIndex(position4.gridColumnStart, position4.totalCols);
210594
+ const endRowExclusive = getExclusiveEndIndex(startRow, normalizedRowSpan, position4.totalRows);
210595
+ const endColExclusive = getExclusiveEndIndex(startCol, normalizedColSpan, position4.totalCols);
210596
+ const hasRows = position4.totalRows > 0;
210597
+ const hasCols = position4.totalCols > 0;
210598
+ return {
210599
+ startRow,
210600
+ endRowExclusive,
210601
+ startCol,
210602
+ endColExclusive,
210603
+ touchesTopEdge: hasRows && startRow === 0,
210604
+ touchesBottomEdge: hasRows && endRowExclusive === position4.totalRows,
210605
+ touchesLeftEdge: hasCols && startCol === 0,
210606
+ touchesRightEdge: hasCols && endColExclusive === position4.totalCols
210607
+ };
210568
210608
  }, ALLOWED_BORDER_STYLES, borderStyleToCSS = (style$1) => {
210569
210609
  if (!style$1 || style$1 === "none")
210570
210610
  return "none";
@@ -210627,16 +210667,18 @@ var Node$13 = class Node$14 {
210627
210667
  spec.space = space;
210628
210668
  return spec;
210629
210669
  }
210630
- }, resolveTableCellBorders = (tableBorders, rowIndex, colIndex, totalRows, totalCols) => {
210631
- const isFirstRow = rowIndex === 0;
210632
- const isLastRow = rowIndex === totalRows - 1;
210633
- const isFirstCol = colIndex === 0;
210634
- const isLastCol = colIndex === totalCols - 1;
210670
+ }, resolveTableBorderValue = (explicit, fallback) => {
210671
+ const explicitSpec = borderValueToSpec(explicit);
210672
+ if (explicitSpec)
210673
+ return explicitSpec;
210674
+ return borderValueToSpec(fallback);
210675
+ }, hasExplicitCellBorders = (cellBorders) => Boolean(cellBorders && (cellBorders.top !== undefined || cellBorders.right !== undefined || cellBorders.bottom !== undefined || cellBorders.left !== undefined)), resolveTableCellBorders = (tableBorders, cellPosition) => {
210676
+ const cellBounds = getTableCellGridBounds(cellPosition);
210635
210677
  return {
210636
- top: borderValueToSpec(isFirstRow ? tableBorders?.top : tableBorders?.insideH),
210637
- bottom: borderValueToSpec(isLastRow ? tableBorders?.bottom : null),
210638
- left: borderValueToSpec(isFirstCol ? tableBorders?.left : tableBorders?.insideV),
210639
- right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
210678
+ top: borderValueToSpec(cellBounds.touchesTopEdge ? tableBorders?.top : tableBorders?.insideH),
210679
+ bottom: borderValueToSpec(cellBounds.touchesBottomEdge ? tableBorders?.bottom : null),
210680
+ left: borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV),
210681
+ right: borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders?.right : null)
210640
210682
  };
210641
210683
  }, applyInlineStyles = (el, styles) => {
210642
210684
  Object.entries(styles).forEach(([key$1, value]) => {
@@ -211148,8 +211190,46 @@ var Node$13 = class Node$14 {
211148
211190
  }
211149
211191
  }
211150
211192
  return { cellElement: cellEl };
211193
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext }) => {
211194
+ const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
211195
+ if (hasBordersAttribute && !hasExplicitBorders)
211196
+ return;
211197
+ if (!tableBorders)
211198
+ return hasExplicitBorders ? {
211199
+ top: cellBorders.top,
211200
+ right: cellBorders.right,
211201
+ bottom: cellBorders.bottom,
211202
+ left: cellBorders.left
211203
+ } : undefined;
211204
+ const cellBounds = getTableCellGridBounds(cellPosition);
211205
+ const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
211206
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
211207
+ if (hasExplicitBorders)
211208
+ return {
211209
+ top: resolveTableBorderValue(cellBorders.top, touchesTopBoundary ? tableBorders.top : tableBorders.insideH),
211210
+ right: resolveTableBorderValue(cellBorders.right, cellBounds.touchesRightEdge ? tableBorders.right : undefined),
211211
+ bottom: resolveTableBorderValue(cellBorders.bottom, touchesBottomBoundary ? tableBorders.bottom : undefined),
211212
+ left: resolveTableBorderValue(cellBorders.left, cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV)
211213
+ };
211214
+ if (cellSpacingPx > 0) {
211215
+ const interiorBorders = {
211216
+ top: touchesTopBoundary ? undefined : borderValueToSpec(tableBorders.insideH),
211217
+ right: cellBounds.touchesRightEdge ? undefined : borderValueToSpec(tableBorders.insideV),
211218
+ bottom: touchesBottomBoundary ? undefined : borderValueToSpec(tableBorders.insideH),
211219
+ left: cellBounds.touchesLeftEdge ? undefined : borderValueToSpec(tableBorders.insideV)
211220
+ };
211221
+ return hasAnyResolvedBorder(interiorBorders) ? interiorBorders : undefined;
211222
+ }
211223
+ const baseBorders = resolveTableCellBorders(tableBorders, cellPosition);
211224
+ return {
211225
+ top: touchesTopBoundary ? borderValueToSpec(tableBorders.top) : baseBorders.top,
211226
+ right: baseBorders.right,
211227
+ bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : baseBorders.bottom,
211228
+ left: baseBorders.left
211229
+ };
211151
211230
  }, renderTableRow = (deps) => {
211152
211231
  const { doc: doc$3, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, tableSdt, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0 } = deps;
211232
+ const totalCols = columnWidths.length;
211153
211233
  const calculateXPosition = (gridColumnStart) => {
211154
211234
  let x = cellSpacingPx;
211155
211235
  for (let i$1 = 0;i$1 < gridColumnStart && i$1 < columnWidths.length; i$1++)
@@ -211162,73 +211242,36 @@ var Node$13 = class Node$14 {
211162
211242
  totalHeight += allRowHeights[startRowIndex + i$1];
211163
211243
  return totalHeight;
211164
211244
  };
211245
+ const calculateColspanWidth = (gridColumnStart, colSpan) => {
211246
+ let width = 0;
211247
+ for (let i$1 = gridColumnStart;i$1 < gridColumnStart + colSpan && i$1 < columnWidths.length; i$1++)
211248
+ width += columnWidths[i$1];
211249
+ return width;
211250
+ };
211165
211251
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
211166
211252
  const cellMeasure = rowMeasure.cells[cellIndex];
211167
211253
  const cell2 = row2?.cells?.[cellIndex];
211168
- const x = cellMeasure.gridColumnStart != null ? calculateXPosition(cellMeasure.gridColumnStart) : cellIndex === 0 ? 0 : calculateXPosition(cellIndex);
211169
- const cellBordersAttr = cell2?.attrs?.borders;
211170
- const hasBordersAttribute = cellBordersAttr !== undefined;
211171
- const hasExplicitBorders = hasBordersAttribute && cellBordersAttr && (cellBordersAttr.top !== undefined || cellBordersAttr.right !== undefined || cellBordersAttr.bottom !== undefined || cellBordersAttr.left !== undefined);
211172
- const gridColIndex = cellMeasure.gridColumnStart ?? cellIndex;
211173
- const totalCols = columnWidths.length;
211174
- let resolvedBorders;
211175
- if (hasBordersAttribute && !hasExplicitBorders)
211176
- resolvedBorders = undefined;
211177
- else if (hasExplicitBorders && tableBorders) {
211178
- const isFirstRow = rowIndex === 0;
211179
- const isLastRow = rowIndex === totalRows - 1;
211180
- const isFirstCol = gridColIndex === 0;
211181
- const isLastCol = gridColIndex === totalCols - 1;
211182
- const treatAsFirstRow = isFirstRow || continuesFromPrev;
211183
- const treatAsLastRow = isLastRow || continuesOnNext;
211184
- resolvedBorders = {
211185
- top: cellBordersAttr.top ?? borderValueToSpec(treatAsFirstRow ? tableBorders.top : tableBorders.insideH),
211186
- bottom: cellBordersAttr.bottom ?? borderValueToSpec(treatAsLastRow ? tableBorders.bottom : undefined),
211187
- left: cellBordersAttr.left ?? borderValueToSpec(isFirstCol ? tableBorders.left : tableBorders.insideV),
211188
- right: cellBordersAttr.right ?? borderValueToSpec(isLastCol ? tableBorders.right : undefined)
211189
- };
211190
- } else if (hasExplicitBorders)
211191
- resolvedBorders = {
211192
- top: cellBordersAttr.top,
211193
- bottom: cellBordersAttr.bottom,
211194
- left: cellBordersAttr.left,
211195
- right: cellBordersAttr.right
211196
- };
211197
- else if (tableBorders)
211198
- if (cellSpacingPx > 0) {
211199
- const isFirstRow = rowIndex === 0;
211200
- const isLastRow = rowIndex === totalRows - 1;
211201
- const isFirstCol = gridColIndex === 0;
211202
- const isLastCol = gridColIndex === totalCols - 1;
211203
- const treatAsFirstRow = isFirstRow || continuesFromPrev;
211204
- const treatAsLastRow = isLastRow || continuesOnNext;
211205
- resolvedBorders = {
211206
- top: !treatAsFirstRow ? borderValueToSpec(tableBorders.insideH) : undefined,
211207
- bottom: !treatAsLastRow ? borderValueToSpec(tableBorders.insideH) : undefined,
211208
- left: !isFirstCol ? borderValueToSpec(tableBorders.insideV) : undefined,
211209
- right: !isLastCol ? borderValueToSpec(tableBorders.insideV) : undefined
211210
- };
211211
- if (!resolvedBorders.top && !resolvedBorders.bottom && !resolvedBorders.left && !resolvedBorders.right)
211212
- resolvedBorders = undefined;
211213
- } else {
211214
- const isFirstRow = rowIndex === 0;
211215
- const isLastRow = rowIndex === totalRows - 1;
211216
- const treatAsFirstRow = isFirstRow || continuesFromPrev;
211217
- const treatAsLastRow = isLastRow || continuesOnNext;
211218
- const baseBorders = resolveTableCellBorders(tableBorders, rowIndex, gridColIndex, totalRows, totalCols);
211219
- if (baseBorders)
211220
- resolvedBorders = {
211221
- top: treatAsFirstRow ? borderValueToSpec(tableBorders.top) : baseBorders.top,
211222
- bottom: treatAsLastRow ? borderValueToSpec(tableBorders.bottom) : baseBorders.bottom,
211223
- left: baseBorders.left,
211224
- right: baseBorders.right
211225
- };
211226
- else
211227
- resolvedBorders = undefined;
211228
- }
211229
- else
211230
- resolvedBorders = undefined;
211254
+ const gridColumnStart = cellMeasure.gridColumnStart ?? cellIndex;
211231
211255
  const rowSpan = cellMeasure.rowSpan ?? 1;
211256
+ const colSpan = cellMeasure.colSpan ?? 1;
211257
+ const x = calculateXPosition(gridColumnStart);
211258
+ const cellBordersAttr = cell2?.attrs?.borders;
211259
+ const resolvedBorders = resolveRenderedCellBorders({
211260
+ cellBorders: cellBordersAttr,
211261
+ hasBordersAttribute: cellBordersAttr !== undefined,
211262
+ tableBorders,
211263
+ cellPosition: {
211264
+ rowIndex,
211265
+ rowSpan,
211266
+ gridColumnStart,
211267
+ colSpan,
211268
+ totalRows,
211269
+ totalCols
211270
+ },
211271
+ cellSpacingPx,
211272
+ continuesFromPrev: continuesFromPrev === true,
211273
+ continuesOnNext: continuesOnNext === true
211274
+ });
211232
211275
  let cellHeight;
211233
211276
  if (partialRow)
211234
211277
  cellHeight = partialRow.partialHeight;
@@ -211238,11 +211281,7 @@ var Node$13 = class Node$14 {
211238
211281
  cellHeight = rowMeasure.height;
211239
211282
  const fromLine = partialRow?.fromLineByCell?.[cellIndex];
211240
211283
  const toLine = partialRow?.toLineByCell?.[cellIndex];
211241
- const colSpan = cellMeasure.colSpan ?? 1;
211242
- const gridStart = cellMeasure.gridColumnStart ?? cellIndex;
211243
- let computedCellWidth = 0;
211244
- for (let i$1 = gridStart;i$1 < gridStart + colSpan && i$1 < columnWidths.length; i$1++)
211245
- computedCellWidth += columnWidths[i$1];
211284
+ const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
211246
211285
  const { cellElement } = renderTableCell({
211247
211286
  doc: doc$3,
211248
211287
  x,
@@ -211475,21 +211514,22 @@ var Node$13 = class Node$14 {
211475
211514
  ghostDiv.style.overflow = "hidden";
211476
211515
  const srcCell = block.rows[r$1]?.cells?.[ci];
211477
211516
  const cellBordersAttr = srcCell?.attrs?.borders;
211478
- const hasExplicitBorders = cellBordersAttr && (cellBordersAttr.top !== undefined || cellBordersAttr.right !== undefined || cellBordersAttr.bottom !== undefined || cellBordersAttr.left !== undefined);
211479
- const isFirstCol = gridCol === 0;
211480
- const isLastCol = gridCol + colSpan >= effectiveColumnWidths.length;
211481
- if (hasExplicitBorders && tableBorders) {
211482
- applyBorder(ghostDiv, "Top", cellBordersAttr.top ?? borderValueToSpec(tableBorders.top));
211483
- applyBorder(ghostDiv, "Left", cellBordersAttr.left ?? borderValueToSpec(isFirstCol ? tableBorders.left : tableBorders.insideV));
211484
- applyBorder(ghostDiv, "Right", cellBordersAttr.right ?? borderValueToSpec(isLastCol ? tableBorders.right : tableBorders.insideV));
211485
- if (effectiveEnd <= fragment2.toRow && spanEndRow <= fragment2.toRow)
211486
- applyBorder(ghostDiv, "Bottom", cellBordersAttr.bottom ?? borderValueToSpec(tableBorders.insideH));
211487
- } else if (tableBorders) {
211488
- applyBorder(ghostDiv, "Top", borderValueToSpec(tableBorders.top));
211489
- applyBorder(ghostDiv, "Left", borderValueToSpec(isFirstCol ? tableBorders.left : tableBorders.insideV));
211490
- applyBorder(ghostDiv, "Right", borderValueToSpec(isLastCol ? tableBorders.right : tableBorders.insideV));
211491
- if (effectiveEnd <= fragment2.toRow && spanEndRow <= fragment2.toRow)
211492
- applyBorder(ghostDiv, "Bottom", borderValueToSpec(tableBorders.insideH));
211517
+ const explicit = hasExplicitCellBorders(cellBordersAttr);
211518
+ const cellBounds = getTableCellGridBounds({
211519
+ rowIndex: r$1,
211520
+ rowSpan,
211521
+ gridColumnStart: gridCol,
211522
+ colSpan,
211523
+ totalRows: block.rows.length,
211524
+ totalCols: effectiveColumnWidths.length
211525
+ });
211526
+ const cellEndsWithinFragment = effectiveEnd <= fragment2.toRow && spanEndRow <= fragment2.toRow;
211527
+ if (tableBorders) {
211528
+ applyBorder(ghostDiv, "Top", (explicit ? cellBordersAttr.top : undefined) ?? borderValueToSpec(tableBorders.top));
211529
+ applyBorder(ghostDiv, "Left", (explicit ? cellBordersAttr.left : undefined) ?? borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV));
211530
+ applyBorder(ghostDiv, "Right", (explicit ? cellBordersAttr.right : undefined) ?? borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders.right : tableBorders.insideV));
211531
+ if (cellEndsWithinFragment)
211532
+ applyBorder(ghostDiv, "Bottom", (explicit ? cellBordersAttr.bottom : undefined) ?? borderValueToSpec(cellBounds.touchesBottomEdge ? tableBorders.bottom : tableBorders.insideH));
211493
211533
  }
211494
211534
  if (srcCell?.attrs?.background)
211495
211535
  ghostDiv.style.backgroundColor = srcCell.attrs.background;
@@ -213646,7 +213686,7 @@ var Node$13 = class Node$14 {
213646
213686
  if (!sanitized)
213647
213687
  return;
213648
213688
  return sanitized;
213649
- }, normalizeFontSizePx = (value) => {
213689
+ }, normalizeLengthPx = (value) => {
213650
213690
  if (isFiniteNumber(value))
213651
213691
  return value;
213652
213692
  if (typeof value !== "string")
@@ -213669,14 +213709,14 @@ var Node$13 = class Node$14 {
213669
213709
  if (sanitized)
213670
213710
  run2.fontFamily = sanitized;
213671
213711
  }
213672
- const fontSizePx = normalizeFontSizePx(attrs.fontSize);
213712
+ const fontSizePx = normalizeLengthPx(attrs.fontSize);
213673
213713
  if (fontSizePx !== undefined && fontSizePx >= 1 && fontSizePx <= 1000)
213674
213714
  run2.fontSize = fontSizePx;
213675
213715
  else if (attrs.fontSize !== undefined) {}
213676
- if (isFiniteNumber(attrs.letterSpacing)) {
213677
- const spacing = Number(attrs.letterSpacing);
213678
- if (spacing >= -100 && spacing <= 100)
213679
- run2.letterSpacing = spacing;
213716
+ const letterSpacingPx = normalizeLengthPx(attrs.letterSpacing);
213717
+ if (letterSpacingPx !== undefined) {
213718
+ if (letterSpacingPx >= -100 && letterSpacingPx <= 100)
213719
+ run2.letterSpacing = letterSpacingPx;
213680
213720
  }
213681
213721
  if (typeof attrs.textTransform === "string") {
213682
213722
  const transform = attrs.textTransform;
@@ -220525,7 +220565,7 @@ var Node$13 = class Node$14 {
220525
220565
  if (!layoutDebugEnabled)
220526
220566
  return;
220527
220567
  console.log(...args$1);
220528
- }, 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, Color, FontFamily, FontSize, TextAlign, FormatCommands, DropCursorView = class {
220568
+ }, 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, Color, FontFamily, FontSize, LetterSpacing, TextAlign, FormatCommands, DropCursorView = class {
220529
220569
  constructor(editorView, options) {
220530
220570
  var _a;
220531
220571
  this.editorView = editorView;
@@ -224151,6 +224191,7 @@ var Node$13 = class Node$14 {
224151
224191
  Document,
224152
224192
  FontFamily,
224153
224193
  FontSize,
224194
+ LetterSpacing,
224154
224195
  History,
224155
224196
  Heading,
224156
224197
  Italic,
@@ -224197,6 +224238,7 @@ var Node$13 = class Node$14 {
224197
224238
  Document,
224198
224239
  FontFamily,
224199
224240
  FontSize,
224241
+ LetterSpacing,
224200
224242
  History,
224201
224243
  Heading,
224202
224244
  Italic,
@@ -225983,7 +226025,7 @@ var Node$13 = class Node$14 {
225983
226025
  trackedChanges: context.trackedChanges ?? []
225984
226026
  });
225985
226027
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
225986
- var init_src_CiSEdgP3_es = __esm(() => {
226028
+ var init_src_D6a7JHkJ_es = __esm(() => {
225987
226029
  init_rolldown_runtime_B2q5OVn9_es();
225988
226030
  init_SuperConverter_BZ7c2IuL_es();
225989
226031
  init_jszip_ChlR43oI_es();
@@ -249052,6 +249094,29 @@ function print() { __p += __j.call(arguments, '') }
249052
249094
  };
249053
249095
  }
249054
249096
  });
249097
+ LetterSpacing = Extension.create({
249098
+ name: "letterSpacing",
249099
+ addOptions() {
249100
+ return { types: ["textStyle"] };
249101
+ },
249102
+ addGlobalAttributes() {
249103
+ return [{
249104
+ types: this.options.types,
249105
+ attributes: { letterSpacing: {
249106
+ default: null,
249107
+ parseDOM: (el) => el.style.letterSpacing || null,
249108
+ renderDOM: (attrs) => {
249109
+ if (!attrs.letterSpacing)
249110
+ return {};
249111
+ const [value, unit] = parseSizeUnit(attrs.letterSpacing);
249112
+ if (Number.isNaN(value))
249113
+ return {};
249114
+ return { style: `letter-spacing: ${value}${unit ?? "pt"}` };
249115
+ }
249116
+ } }
249117
+ }];
249118
+ }
249119
+ });
249055
249120
  TextAlign = Extension.create({
249056
249121
  name: "textAlign",
249057
249122
  addOptions() {
@@ -259480,8 +259545,8 @@ function print() { __p += __j.call(arguments, '') }
259480
259545
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
259481
259546
  };
259482
259547
  stubFalse_default = stubFalse;
259483
- freeExports$2 = typeof exports_src_CiSEdgP3_es == "object" && exports_src_CiSEdgP3_es && !exports_src_CiSEdgP3_es.nodeType && exports_src_CiSEdgP3_es;
259484
- freeModule$2 = freeExports$2 && typeof module_src_CiSEdgP3_es == "object" && module_src_CiSEdgP3_es && !module_src_CiSEdgP3_es.nodeType && module_src_CiSEdgP3_es;
259548
+ freeExports$2 = typeof exports_src_D6a7JHkJ_es == "object" && exports_src_D6a7JHkJ_es && !exports_src_D6a7JHkJ_es.nodeType && exports_src_D6a7JHkJ_es;
259549
+ freeModule$2 = freeExports$2 && typeof module_src_D6a7JHkJ_es == "object" && module_src_D6a7JHkJ_es && !module_src_D6a7JHkJ_es.nodeType && module_src_D6a7JHkJ_es;
259485
259550
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
259486
259551
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
259487
259552
  typedArrayTags = {};
@@ -259489,8 +259554,8 @@ function print() { __p += __j.call(arguments, '') }
259489
259554
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
259490
259555
  _baseIsTypedArray_default = baseIsTypedArray;
259491
259556
  _baseUnary_default = baseUnary;
259492
- freeExports$1 = typeof exports_src_CiSEdgP3_es == "object" && exports_src_CiSEdgP3_es && !exports_src_CiSEdgP3_es.nodeType && exports_src_CiSEdgP3_es;
259493
- freeModule$1 = freeExports$1 && typeof module_src_CiSEdgP3_es == "object" && module_src_CiSEdgP3_es && !module_src_CiSEdgP3_es.nodeType && module_src_CiSEdgP3_es;
259557
+ freeExports$1 = typeof exports_src_D6a7JHkJ_es == "object" && exports_src_D6a7JHkJ_es && !exports_src_D6a7JHkJ_es.nodeType && exports_src_D6a7JHkJ_es;
259558
+ freeModule$1 = freeExports$1 && typeof module_src_D6a7JHkJ_es == "object" && module_src_D6a7JHkJ_es && !module_src_D6a7JHkJ_es.nodeType && module_src_D6a7JHkJ_es;
259494
259559
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
259495
259560
  _nodeUtil_default = function() {
259496
259561
  try {
@@ -259595,8 +259660,8 @@ function print() { __p += __j.call(arguments, '') }
259595
259660
  Stack.prototype.has = _stackHas_default;
259596
259661
  Stack.prototype.set = _stackSet_default;
259597
259662
  _Stack_default = Stack;
259598
- freeExports = typeof exports_src_CiSEdgP3_es == "object" && exports_src_CiSEdgP3_es && !exports_src_CiSEdgP3_es.nodeType && exports_src_CiSEdgP3_es;
259599
- freeModule = freeExports && typeof module_src_CiSEdgP3_es == "object" && module_src_CiSEdgP3_es && !module_src_CiSEdgP3_es.nodeType && module_src_CiSEdgP3_es;
259663
+ freeExports = typeof exports_src_D6a7JHkJ_es == "object" && exports_src_D6a7JHkJ_es && !exports_src_D6a7JHkJ_es.nodeType && exports_src_D6a7JHkJ_es;
259664
+ freeModule = freeExports && typeof module_src_D6a7JHkJ_es == "object" && module_src_D6a7JHkJ_es && !module_src_D6a7JHkJ_es.nodeType && module_src_D6a7JHkJ_es;
259600
259665
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
259601
259666
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
259602
259667
  _cloneBuffer_default = cloneBuffer;
@@ -267153,6 +267218,26 @@ function print() { __p += __j.call(arguments, '') }
267153
267218
  });
267154
267219
  }
267155
267220
  };
267221
+ const waitForCollaborativeFragmentSettling = async (ydoc, maxWaitMs = 200) => {
267222
+ const fragment2 = ydoc.getXmlFragment("supereditor");
267223
+ if (fragment2.length > 0)
267224
+ return fragment2;
267225
+ await new Promise((resolve4) => {
267226
+ const timeout$1 = setTimeout(() => {
267227
+ fragment2.unobserve?.(observer);
267228
+ resolve4();
267229
+ }, maxWaitMs);
267230
+ const observer = () => {
267231
+ if (fragment2.length <= 0)
267232
+ return;
267233
+ clearTimeout(timeout$1);
267234
+ fragment2.unobserve?.(observer);
267235
+ resolve4();
267236
+ };
267237
+ fragment2.observe?.(observer);
267238
+ });
267239
+ return fragment2;
267240
+ };
267156
267241
  const initializeData = async () => {
267157
267242
  if (props.fileSource) {
267158
267243
  let fileData = await loadNewFileData();
@@ -267183,14 +267268,25 @@ function print() { __p += __j.call(arguments, '') }
267183
267268
  };
267184
267269
  waitForSync().then(async () => {
267185
267270
  const partsMap = ydoc.getMap("parts");
267186
- const fragment2 = ydoc.getXmlFragment("supereditor");
267187
267271
  const metaMap = ydoc.getMap("meta");
267188
- const hasPartsContent = fragment2.length > 0 || partsMap.size > 0;
267189
267272
  const hasLegacyContent = metaMap.has("docx");
267190
- if (hasPartsContent || hasLegacyContent)
267273
+ const fragment2 = hasLegacyContent ? ydoc.getXmlFragment("supereditor") : await waitForCollaborativeFragmentSettling(ydoc);
267274
+ if (fragment2.length > 0 || partsMap.size > 0 || hasLegacyContent) {
267275
+ props.options.isNewFile = false;
267276
+ if (fragment2.length > 0) {
267277
+ props.options.fragment = fragment2;
267278
+ initEditor({});
267279
+ return;
267280
+ }
267281
+ delete props.options.fragment;
267282
+ if (hasLegacyContent) {
267283
+ initEditor({ content: metaMap.get("docx") });
267284
+ return;
267285
+ }
267191
267286
  initEditor({});
267192
- else {
267287
+ } else {
267193
267288
  props.options.isNewFile = true;
267289
+ delete props.options.fragment;
267194
267290
  const fileData = await loadNewFileData();
267195
267291
  if (fileData)
267196
267292
  initEditor(fileData);
@@ -267527,7 +267623,7 @@ function print() { __p += __j.call(arguments, '') }
267527
267623
  ], 6);
267528
267624
  };
267529
267625
  }
267530
- }), [["__scopeId", "data-v-cdf2871f"]]);
267626
+ }), [["__scopeId", "data-v-03ffec34"]]);
267531
267627
  _hoisted_1 = ["innerHTML"];
267532
267628
  SuperInput_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
267533
267629
  __name: "SuperInput",
@@ -267661,7 +267757,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
267661
267757
 
267662
267758
  // ../../packages/superdoc/dist/super-editor.es.js
267663
267759
  var init_super_editor_es = __esm(() => {
267664
- init_src_CiSEdgP3_es();
267760
+ init_src_D6a7JHkJ_es();
267665
267761
  init_SuperConverter_BZ7c2IuL_es();
267666
267762
  init_jszip_ChlR43oI_es();
267667
267763
  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.110",
3
+ "version": "0.2.0-next.114",
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.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.110",
34
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.110",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.110",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.110",
37
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.110"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.114",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.114",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.114",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.114",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.114"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",