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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +243 -111
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -207122,7 +207122,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207122
207122
  init_remark_gfm_BhnWr3yf_es();
207123
207123
  });
207124
207124
 
207125
- // ../../packages/superdoc/dist/chunks/src-CCV76OsP.es.js
207125
+ // ../../packages/superdoc/dist/chunks/src-BzRjWTpH.es.js
207126
207126
  function deleteProps(obj, propOrProps) {
207127
207127
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207128
207128
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -207334,6 +207334,18 @@ function calculateTabWidth(params$1) {
207334
207334
  tabStopPosUsed: nextStop.pos
207335
207335
  };
207336
207336
  }
207337
+ function resolveTableWidthAttr(value) {
207338
+ if (!value || typeof value !== "object")
207339
+ return null;
207340
+ const measurement = value;
207341
+ const width = measurement.width ?? measurement.value;
207342
+ if (typeof width !== "number" || !Number.isFinite(width) || width <= 0)
207343
+ return null;
207344
+ return {
207345
+ width,
207346
+ type: measurement.type
207347
+ };
207348
+ }
207337
207349
  function resolveColumnWidths(columns, availableWidth) {
207338
207350
  const width = availableWidth / columns.length;
207339
207351
  return columns.map(() => width);
@@ -221842,7 +221854,8 @@ function executeTextSelector(editor, index2, query2, diagnostics) {
221842
221854
  const rawResult = requireEditorCommand(editor.commands?.search, "find (search)")(pattern, {
221843
221855
  highlight: false,
221844
221856
  caseSensitive: selector.caseSensitive ?? false,
221845
- maxMatches: Infinity
221857
+ maxMatches: Infinity,
221858
+ searchModel: "visible"
221846
221859
  });
221847
221860
  if (!Array.isArray(rawResult))
221848
221861
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
@@ -228977,6 +228990,28 @@ function toNotFoundError(input2) {
228977
228990
  function isSameTarget(left$1, right$1) {
228978
228991
  return left$1.blockId === right$1.blockId && left$1.range.start === right$1.range.start && left$1.range.end === right$1.range.end;
228979
228992
  }
228993
+ function isTextAddressShape(target) {
228994
+ if (!target || typeof target !== "object")
228995
+ return false;
228996
+ const t = target;
228997
+ if (t.kind !== "text")
228998
+ return false;
228999
+ if (typeof t.blockId !== "string")
229000
+ return false;
229001
+ return isTextRangeShape(t.range);
229002
+ }
229003
+ function isTextRangeShape(range) {
229004
+ if (!range || typeof range !== "object")
229005
+ return false;
229006
+ const r$1 = range;
229007
+ return Number.isInteger(r$1.start) && Number.isInteger(r$1.end) && r$1.start <= r$1.end;
229008
+ }
229009
+ function isTextSegmentShape(segment) {
229010
+ if (!segment || typeof segment !== "object")
229011
+ return false;
229012
+ const seg = segment;
229013
+ return typeof seg.blockId === "string" && isTextRangeShape(seg.range);
229014
+ }
228980
229015
  function isTextTargetShape(target) {
228981
229016
  if (!target || typeof target !== "object")
228982
229017
  return false;
@@ -228985,17 +229020,19 @@ function isTextTargetShape(target) {
228985
229020
  return false;
228986
229021
  if (!Array.isArray(t.segments) || t.segments.length === 0)
228987
229022
  return false;
228988
- if (typeof t.blockId === "string" || t.range !== undefined && t.range !== null)
229023
+ if (!t.segments.every(isTextSegmentShape))
228989
229024
  return false;
228990
229025
  return true;
228991
229026
  }
228992
229027
  function targetToSegments(target) {
229028
+ if (isTextAddressShape(target))
229029
+ return [{
229030
+ blockId: target.blockId,
229031
+ range: target.range
229032
+ }];
228993
229033
  if (isTextTargetShape(target))
228994
229034
  return [...target.segments];
228995
- return [{
228996
- blockId: target.blockId,
228997
- range: target.range
228998
- }];
229035
+ return null;
228999
229036
  }
229000
229037
  function listCommentAnchorsSafe(editor) {
229001
229038
  try {
@@ -229213,6 +229250,15 @@ function addCommentHandler(editor, input2, options) {
229213
229250
  }
229214
229251
  };
229215
229252
  const segments = targetToSegments(target);
229253
+ if (!segments)
229254
+ return {
229255
+ success: false,
229256
+ failure: {
229257
+ code: "INVALID_TARGET",
229258
+ message: "Comment target must be a TextAddress or TextTarget.",
229259
+ details: { target }
229260
+ }
229261
+ };
229216
229262
  for (const seg of segments)
229217
229263
  if (seg.range.start === seg.range.end)
229218
229264
  return {
@@ -234132,8 +234178,9 @@ function resolveCurrentSelectionInfo(editor, input2) {
234132
234178
  activeCommentIds: [],
234133
234179
  activeChangeIds: []
234134
234180
  };
234135
- const { from: from$1, to, empty: empty$1 } = state.selection;
234136
- const segments = collectTextSegments(state.doc, from$1, to);
234181
+ const sel = state.selection;
234182
+ const { from: from$1, to, empty: empty$1 } = sel;
234183
+ const segments = shouldProjectTextTarget(sel) ? collectTextSegments(state.doc, from$1, to) : null;
234137
234184
  const target = segments && segments.length > 0 ? buildTextTarget(segments) : null;
234138
234185
  const activeMarks = collectActiveMarks(state, from$1, to);
234139
234186
  const { commentIds: activeCommentIds, changeIds: activeChangeRawIds } = collectActiveEntityIds(state, from$1, to);
@@ -234154,6 +234201,15 @@ function buildTextTarget(segments) {
234154
234201
  segments
234155
234202
  };
234156
234203
  }
234204
+ function shouldProjectTextTarget(selection) {
234205
+ if (!selection || typeof selection !== "object")
234206
+ return false;
234207
+ if (selection instanceof NodeSelection)
234208
+ return false;
234209
+ if ("$anchorCell" in selection)
234210
+ return false;
234211
+ return true;
234212
+ }
234157
234213
  function collectTextSegments(doc$12, from$1, to) {
234158
234214
  const segments = [];
234159
234215
  let abort = false;
@@ -254417,23 +254473,37 @@ function applyTableIndent(x, width, indent2, columnWidth) {
254417
254473
  x: shiftedX,
254418
254474
  width: Math.max(0, width - indent2)
254419
254475
  };
254476
+ if (width > columnWidth)
254477
+ return {
254478
+ x: shiftedX,
254479
+ width
254480
+ };
254420
254481
  const maxWidthWithinColumn = Math.max(0, columnWidth - indent2);
254421
254482
  return {
254422
254483
  x: shiftedX,
254423
254484
  width: Math.min(width, maxWidthWithinColumn)
254424
254485
  };
254425
254486
  }
254487
+ function resolveRenderedTableWidth(columnWidth, measuredWidth, attrs) {
254488
+ const safeMeasuredWidth = Number.isFinite(measuredWidth) && measuredWidth > 0 ? measuredWidth : Math.max(0, columnWidth);
254489
+ const configuredWidth = resolveTableWidthAttr(attrs?.tableWidth);
254490
+ if (!configuredWidth)
254491
+ return safeMeasuredWidth;
254492
+ if (configuredWidth.type === "pct")
254493
+ return Math.max(0, Math.round(columnWidth * (configuredWidth.width / OOXML_PCT_DIVISOR)));
254494
+ return safeMeasuredWidth;
254495
+ }
254426
254496
  function resolveTableFrame(baseX, columnWidth, tableWidth, attrs) {
254427
- const width = Math.min(columnWidth, tableWidth);
254497
+ const width = resolveRenderedTableWidth(columnWidth, tableWidth, attrs);
254428
254498
  const justification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
254429
254499
  if (justification === "center")
254430
254500
  return {
254431
- x: baseX + Math.max(0, (columnWidth - width) / 2),
254501
+ x: baseX + (columnWidth - width) / 2,
254432
254502
  width
254433
254503
  };
254434
254504
  if (justification === "right" || justification === "end")
254435
254505
  return {
254436
- x: baseX + Math.max(0, columnWidth - width),
254506
+ x: baseX + (columnWidth - width),
254437
254507
  width
254438
254508
  };
254439
254509
  return applyTableIndent(baseX, width, getTableIndentWidth(attrs), columnWidth);
@@ -254863,13 +254933,14 @@ function layoutMonolithicTable(context) {
254863
254933
  state = context.ensurePage();
254864
254934
  const height = Math.min(context.measure.totalHeight, state.contentBottom - state.cursorY);
254865
254935
  const baseX = context.columnX(state.columnIndex);
254866
- const baseWidth = Math.min(context.columnWidth, context.measure.totalWidth || context.columnWidth);
254936
+ const baseWidth = Math.max(0, context.measure.totalWidth || context.columnWidth);
254867
254937
  const { x, width } = resolveTableFrame(baseX, context.columnWidth, baseWidth, context.block.attrs);
254868
254938
  const columnWidths = rescaleColumnWidths(context.measure.columnWidths, context.measure.totalWidth, width);
254869
254939
  const metadata = generateFragmentMetadata(context.measure, context.block, 0, context.block.rows.length, 0, columnWidths);
254870
254940
  const fragment2 = {
254871
254941
  kind: "table",
254872
254942
  blockId: context.block.id,
254943
+ columnIndex: state.columnIndex,
254873
254944
  fromRow: 0,
254874
254945
  toRow: context.block.rows.length,
254875
254946
  x,
@@ -254941,12 +255012,13 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
254941
255012
  let pendingPartialRow = null;
254942
255013
  if (block.rows.length === 0 && measure.totalHeight > 0) {
254943
255014
  const height = Math.min(measure.totalHeight, state.contentBottom - state.cursorY);
254944
- const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
255015
+ const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
254945
255016
  const columnWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width);
254946
255017
  const metadata = generateFragmentMetadata(measure, block, 0, 0, 0, columnWidths);
254947
255018
  const fragment2 = {
254948
255019
  kind: "table",
254949
255020
  blockId: block.id,
255021
+ columnIndex: state.columnIndex,
254950
255022
  fromRow: 0,
254951
255023
  toRow: 0,
254952
255024
  x,
@@ -255011,11 +255083,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
255011
255083
  });
255012
255084
  const fragmentHeight$1 = computeFragmentHeight$1(measure, rowIndex, rowIndex + 1, repeatHeaderCount, borderCollapse, continuationPartialRow);
255013
255085
  if (fragmentHeight$1 > 0 && madeProgress) {
255014
- const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
255086
+ const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
255015
255087
  const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
255016
255088
  const fragment$1 = {
255017
255089
  kind: "table",
255018
255090
  blockId: block.id,
255091
+ columnIndex: state.columnIndex,
255019
255092
  fromRow: rowIndex,
255020
255093
  toRow: rowIndex + 1,
255021
255094
  x: x$1,
@@ -255067,11 +255140,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
255067
255140
  }
255068
255141
  const forcedEndRow = bodyStartRow + 1;
255069
255142
  const fragmentHeight$1 = computeFragmentHeight$1(measure, bodyStartRow, forcedEndRow, repeatHeaderCount, borderCollapse, forcedPartialRow);
255070
- const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
255143
+ const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
255071
255144
  const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
255072
255145
  const fragment$1 = {
255073
255146
  kind: "table",
255074
255147
  blockId: block.id,
255148
+ columnIndex: state.columnIndex,
255075
255149
  fromRow: bodyStartRow,
255076
255150
  toRow: forcedEndRow,
255077
255151
  x: x$1,
@@ -255096,11 +255170,12 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
255096
255170
  continue;
255097
255171
  }
255098
255172
  const fragmentHeight = computeFragmentHeight$1(measure, bodyStartRow, endRow, repeatHeaderCount, borderCollapse, partialRow);
255099
- const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
255173
+ const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.max(0, measure.totalWidth || columnWidth), block.attrs);
255100
255174
  const scaledWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width);
255101
255175
  const fragment2 = {
255102
255176
  kind: "table",
255103
255177
  blockId: block.id,
255178
+ columnIndex: state.columnIndex,
255104
255179
  fromRow: bodyStartRow,
255105
255180
  toRow: endRow,
255106
255181
  x,
@@ -259196,32 +259271,12 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
259196
259271
  return;
259197
259272
  if (!block || block.kind !== "table")
259198
259273
  return;
259199
- const tableWidthRaw = Math.max(0, measure.totalWidth ?? 0);
259200
- let tableWidth = Math.min(contentWidth, tableWidthRaw);
259201
- let tableX = columnX;
259202
- const justification = typeof block.attrs?.justification === "string" ? block.attrs.justification : undefined;
259203
- if (justification === "center")
259204
- tableX = columnX + Math.max(0, (contentWidth - tableWidth) / 2);
259205
- else if (justification === "right" || justification === "end")
259206
- tableX = columnX + Math.max(0, contentWidth - tableWidth);
259207
- else {
259208
- const indentValue = block.attrs?.tableIndent?.width;
259209
- const indent2 = typeof indentValue === "number" && Number.isFinite(indentValue) ? indentValue : 0;
259210
- tableX += indent2;
259211
- tableWidth = Math.max(0, tableWidth - indent2);
259212
- }
259213
- let fragmentColumnWidths;
259214
- if (tableWidthRaw > tableWidth && measure.columnWidths && measure.columnWidths.length > 0 && tableWidthRaw > 0) {
259215
- const scale = tableWidth / tableWidthRaw;
259216
- fragmentColumnWidths = measure.columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
259217
- const scaledSum = fragmentColumnWidths.reduce((a2, b$1) => a2 + b$1, 0);
259218
- const target = Math.round(tableWidth);
259219
- if (scaledSum !== target && fragmentColumnWidths.length > 0)
259220
- fragmentColumnWidths[fragmentColumnWidths.length - 1] = Math.max(1, fragmentColumnWidths[fragmentColumnWidths.length - 1] + (target - scaledSum));
259221
- }
259274
+ const { x: tableX, width: tableWidth } = resolveTableFrame(columnX, contentWidth, Math.max(0, measure.totalWidth ?? contentWidth), block.attrs);
259275
+ const fragmentColumnWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, tableWidth);
259222
259276
  page.fragments.push({
259223
259277
  kind: "table",
259224
259278
  blockId: range.blockId,
259279
+ columnIndex,
259225
259280
  fromRow: 0,
259226
259281
  toRow: block.rows.length,
259227
259282
  x: tableX,
@@ -259964,7 +260019,7 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
259964
260019
  layoutEpoch,
259965
260020
  blockId: tableHit.fragment.blockId,
259966
260021
  pageIndex,
259967
- column: determineColumn(layout, tableHit.fragment.x),
260022
+ column: determineTableColumn(layout, tableHit.fragment),
259968
260023
  lineIndex
259969
260024
  };
259970
260025
  }
@@ -259975,7 +260030,7 @@ function clickToPositionGeometry(layout, blocks2, measures, containerPoint, opti
259975
260030
  layoutEpoch,
259976
260031
  blockId: tableHit.fragment.blockId,
259977
260032
  pageIndex,
259978
- column: determineColumn(layout, tableHit.fragment.x),
260033
+ column: determineTableColumn(layout, tableHit.fragment),
259979
260034
  lineIndex: 0
259980
260035
  };
259981
260036
  }
@@ -266280,30 +266335,21 @@ async function measureParagraphBlock(block, maxWidth) {
266280
266335
  ...dropCapMeasure ? { dropCap: dropCapMeasure } : {}
266281
266336
  };
266282
266337
  }
266283
- function validateTableWidthValue(attr) {
266284
- const value = attr.width ?? attr.value;
266285
- if (typeof value === "number" && Number.isFinite(value) && value > 0)
266286
- return value;
266287
- }
266288
266338
  function resolveTableWidth(attrs, maxWidth) {
266289
- const tableWidthAttr = attrs?.tableWidth;
266290
- if (!tableWidthAttr || typeof tableWidthAttr !== "object")
266291
- return;
266292
- const typedAttr = tableWidthAttr;
266293
- const validValue = validateTableWidthValue(typedAttr);
266294
- if (validValue === undefined)
266339
+ const tableWidthAttr = resolveTableWidthAttr(attrs?.tableWidth);
266340
+ if (!tableWidthAttr)
266295
266341
  return;
266296
- if (typedAttr.type === "pct")
266297
- return Math.round(maxWidth * (validValue / OOXML_PCT_DIVISOR));
266298
- else if (typedAttr.type === "px" || typedAttr.type === "pixel" || typedAttr.type === "dxa")
266299
- return validValue;
266342
+ if (tableWidthAttr.type === "pct")
266343
+ return Math.round(maxWidth * (tableWidthAttr.width / OOXML_PCT_DIVISOR));
266344
+ else if (tableWidthAttr.type === "px" || tableWidthAttr.type === "pixel" || tableWidthAttr.type === "dxa")
266345
+ return tableWidthAttr.width;
266300
266346
  }
266301
266347
  async function measureTableBlock(block, constraints) {
266302
266348
  const maxWidth = typeof constraints === "number" ? constraints : constraints.maxWidth;
266303
266349
  const resolvedTableWidth = resolveTableWidth(block.attrs, maxWidth);
266304
266350
  let columnWidths;
266305
266351
  const maxCellCount = Math.max(1, Math.max(...block.rows.map((r$1) => r$1.cells.reduce((sum, cell2) => sum + (cell2.colSpan ?? 1), 0))));
266306
- const effectiveTargetWidth = resolvedTableWidth != null ? Math.min(resolvedTableWidth, maxWidth) : maxWidth;
266352
+ const effectiveTargetWidth = resolvedTableWidth != null ? resolvedTableWidth : maxWidth;
266307
266353
  if (block.columnWidths && block.columnWidths.length > 0) {
266308
266354
  columnWidths = [...block.columnWidths];
266309
266355
  const hasExplicitWidth = resolvedTableWidth != null;
@@ -266311,35 +266357,24 @@ async function measureTableBlock(block, constraints) {
266311
266357
  if (hasExplicitWidth || hasFixedLayout) {
266312
266358
  const totalWidth$1 = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266313
266359
  const tableWidthType = block.attrs?.tableWidth?.type;
266314
- if ((totalWidth$1 > effectiveTargetWidth || totalWidth$1 < effectiveTargetWidth && effectiveTargetWidth > 0 && (tableWidthType === "pct" || hasExplicitWidth && !hasFixedLayout)) && effectiveTargetWidth > 0 && totalWidth$1 > 0) {
266315
- const scale = effectiveTargetWidth / totalWidth$1;
266316
- columnWidths = columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
266317
- const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266318
- if (scaledSum !== effectiveTargetWidth && columnWidths.length > 0) {
266319
- const diff = effectiveTargetWidth - scaledSum;
266320
- columnWidths[columnWidths.length - 1] = Math.max(1, columnWidths[columnWidths.length - 1] + diff);
266321
- }
266322
- }
266323
- } else {
266324
- if (columnWidths.length < maxCellCount) {
266325
- const usedWidth = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266326
- const remainingWidth = Math.max(0, effectiveTargetWidth - usedWidth);
266327
- const missingColumns = maxCellCount - columnWidths.length;
266328
- const paddingWidth = Math.max(1, Math.floor(remainingWidth / missingColumns));
266329
- columnWidths.push(...Array.from({ length: missingColumns }, () => paddingWidth));
266330
- } else if (columnWidths.length > maxCellCount)
266331
- columnWidths = columnWidths.slice(0, maxCellCount);
266332
- const totalWidth$1 = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266333
- if (totalWidth$1 > effectiveTargetWidth && effectiveTargetWidth > 0) {
266334
- const scale = effectiveTargetWidth / totalWidth$1;
266360
+ const targetWidth = hasExplicitWidth ? effectiveTargetWidth : totalWidth$1;
266361
+ if ((totalWidth$1 > targetWidth || totalWidth$1 < targetWidth && targetWidth > 0 && (tableWidthType === "pct" || hasExplicitWidth && !hasFixedLayout)) && targetWidth > 0 && totalWidth$1 > 0) {
266362
+ const scale = targetWidth / totalWidth$1;
266335
266363
  columnWidths = columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
266336
266364
  const scaledSum = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266337
- if (scaledSum !== effectiveTargetWidth && columnWidths.length > 0) {
266338
- const diff = effectiveTargetWidth - scaledSum;
266365
+ if (scaledSum !== targetWidth && columnWidths.length > 0) {
266366
+ const diff = targetWidth - scaledSum;
266339
266367
  columnWidths[columnWidths.length - 1] = Math.max(1, columnWidths[columnWidths.length - 1] + diff);
266340
266368
  }
266341
266369
  }
266342
- }
266370
+ } else if (columnWidths.length < maxCellCount) {
266371
+ const usedWidth = columnWidths.reduce((a2, b$1) => a2 + b$1, 0);
266372
+ const remainingWidth = Math.max(0, effectiveTargetWidth - usedWidth);
266373
+ const missingColumns = maxCellCount - columnWidths.length;
266374
+ const paddingWidth = Math.max(1, Math.floor(remainingWidth / missingColumns));
266375
+ columnWidths.push(...Array.from({ length: missingColumns }, () => paddingWidth));
266376
+ } else if (columnWidths.length > maxCellCount)
266377
+ columnWidths = columnWidths.slice(0, maxCellCount);
266343
266378
  } else {
266344
266379
  const columnWidth = Math.max(1, Math.floor(effectiveTargetWidth / maxCellCount));
266345
266380
  columnWidths = Array.from({ length: maxCellCount }, () => columnWidth);
@@ -277246,7 +277281,7 @@ var Node$13 = class Node$14 {
277246
277281
  this.deco = deco;
277247
277282
  }
277248
277283
  }, searchKey, BLOCK_SEPARATOR = `
277249
- `, ATOM_PLACEHOLDER = "", SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
277284
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$1 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
277250
277285
  const matches2 = [];
277251
277286
  for (const indexMatch of indexMatches) {
277252
277287
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
@@ -278583,7 +278618,7 @@ var Node$13 = class Node$14 {
278583
278618
  });
278584
278619
  const renderSearchDropdown = () => {
278585
278620
  const handleSubmit = ({ value }) => {
278586
- superToolbar.activeEditor.commands.search(value);
278621
+ superToolbar.activeEditor.commands.search(value, { searchModel: "visible" });
278587
278622
  };
278588
278623
  return exports_vue.h("div", {}, [exports_vue.h(SearchInput_default, {
278589
278624
  onSubmit: handleSubmit,
@@ -289342,7 +289377,9 @@ menclose::after {
289342
289377
  let columnIndex = 0;
289343
289378
  if (columns && columns.count > 1 && page) {
289344
289379
  const fragment2 = findFragmentForPos(page, ref$1.pos);
289345
- if (fragment2 && typeof fragment2.x === "number") {
289380
+ if (fragment2?.kind === "table" && typeof fragment2.columnIndex === "number")
289381
+ columnIndex = Math.max(0, Math.min(columns.count - 1, fragment2.columnIndex));
289382
+ else if (fragment2 && typeof fragment2.x === "number") {
289346
289383
  const widths = Array.isArray(columns.widths) && columns.widths.length > 0 ? columns.widths : undefined;
289347
289384
  if (widths) {
289348
289385
  let cursorX = columns.left;
@@ -289944,6 +289981,12 @@ menclose::after {
289944
289981
  const relative = fragmentX;
289945
289982
  const raw = Math.floor(relative / Math.max(span, 1));
289946
289983
  return Math.max(0, Math.min(columns.count - 1, raw));
289984
+ }, determineTableColumn = (layout, fragment2) => {
289985
+ if (typeof fragment2.columnIndex === "number") {
289986
+ const count2 = layout.columns?.count ?? 1;
289987
+ return Math.max(0, Math.min(Math.max(0, count2 - 1), fragment2.columnIndex));
289988
+ }
289989
+ return determineColumn(layout, fragment2.x);
289947
289990
  }, findLineIndexAtY = (lines, offsetY, fromLine, toLine) => {
289948
289991
  if (!lines || lines.length === 0)
289949
289992
  return null;
@@ -296480,7 +296523,7 @@ menclose::after {
296480
296523
  return;
296481
296524
  console.log(...args$1);
296482
296525
  }, 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;
296483
- var init_src_CCV76OsP_es = __esm(() => {
296526
+ var init_src_BzRjWTpH_es = __esm(() => {
296484
296527
  init_rolldown_runtime_Bg48TavK_es();
296485
296528
  init_SuperConverter_BTy5lByv_es();
296486
296529
  init_jszip_C49i9kUs_es();
@@ -296511,6 +296554,7 @@ var init_src_CCV76OsP_es = __esm(() => {
296511
296554
  measureRowHeights: () => measureRowHeights,
296512
296555
  resolveColumnWidths: () => resolveColumnWidths,
296513
296556
  resolveSpacingIndent: () => resolveSpacingIndent,
296557
+ resolveTableWidthAttr: () => resolveTableWidthAttr,
296514
296558
  scaleWrapPolygon: () => scaleWrapPolygon
296515
296559
  }, 1);
296516
296560
  floor4 = Math.floor;
@@ -313863,19 +313907,69 @@ function print() { __p += __j.call(arguments, '') }
313863
313907
  valid = false;
313864
313908
  docSize = 0;
313865
313909
  doc = null;
313866
- build(doc$12) {
313867
- this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, ATOM_PLACEHOLDER);
313910
+ searchModel = DEFAULT_SEARCH_MODEL$1;
313911
+ build(doc$12, options = {}) {
313912
+ const searchModel = options?.searchModel === "visible" ? "visible" : DEFAULT_SEARCH_MODEL$1;
313913
+ if (searchModel === "visible")
313914
+ this.#buildVisible(doc$12);
313915
+ else
313916
+ this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, ATOM_PLACEHOLDER);
313868
313917
  this.segments = [];
313869
313918
  this.docSize = doc$12.content.size;
313870
313919
  this.doc = doc$12;
313920
+ this.searchModel = searchModel;
313871
313921
  let offset$1 = 0;
313922
+ const visibleContext = searchModel === "visible" ? { deletionBarrierActive: false } : null;
313872
313923
  this.#walkNodeContent(doc$12, 0, offset$1, (segment) => {
313873
313924
  this.segments.push(segment);
313874
313925
  offset$1 = segment.offsetEnd;
313875
- });
313926
+ }, searchModel, visibleContext);
313876
313927
  this.valid = true;
313877
313928
  }
313878
- #walkNodeContent(node3, contentStart, offset$1, addSegment) {
313929
+ #buildVisible(doc$12) {
313930
+ const parts = [];
313931
+ let emittedDeletionBarrier = false;
313932
+ const appendDeletionBarrier = () => {
313933
+ if (emittedDeletionBarrier)
313934
+ return;
313935
+ parts.push(DELETION_BARRIER);
313936
+ emittedDeletionBarrier = true;
313937
+ };
313938
+ const walkNodeContent2 = (node3) => {
313939
+ let isFirstChild = true;
313940
+ node3.forEach((child) => {
313941
+ if (child.isBlock && !isFirstChild) {
313942
+ parts.push(BLOCK_SEPARATOR);
313943
+ emittedDeletionBarrier = false;
313944
+ }
313945
+ walkNode2(child);
313946
+ isFirstChild = false;
313947
+ });
313948
+ };
313949
+ const walkNode2 = (node3) => {
313950
+ if (node3.isText) {
313951
+ const text5 = node3.text || "";
313952
+ if (!text5.length)
313953
+ return;
313954
+ if (hasTrackDeleteMark$1(node3)) {
313955
+ appendDeletionBarrier();
313956
+ return;
313957
+ }
313958
+ parts.push(text5);
313959
+ emittedDeletionBarrier = false;
313960
+ return;
313961
+ }
313962
+ if (node3.isLeaf) {
313963
+ parts.push(ATOM_PLACEHOLDER);
313964
+ emittedDeletionBarrier = false;
313965
+ return;
313966
+ }
313967
+ walkNodeContent2(node3);
313968
+ };
313969
+ walkNodeContent2(doc$12);
313970
+ this.text = parts.join("");
313971
+ }
313972
+ #walkNodeContent(node3, contentStart, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
313879
313973
  let currentOffset = offset$1;
313880
313974
  let isFirstChild = true;
313881
313975
  node3.forEach((child, childContentOffset) => {
@@ -313889,16 +313983,34 @@ function print() { __p += __j.call(arguments, '') }
313889
313983
  kind: "blockSep"
313890
313984
  });
313891
313985
  currentOffset += 1;
313986
+ if (context && searchModel === "visible")
313987
+ context.deletionBarrierActive = false;
313892
313988
  }
313893
- currentOffset = this.#walkNode(child, childDocPos, currentOffset, addSegment);
313989
+ currentOffset = this.#walkNode(child, childDocPos, currentOffset, addSegment, searchModel, context);
313894
313990
  isFirstChild = false;
313895
313991
  });
313896
313992
  return currentOffset;
313897
313993
  }
313898
- #walkNode(node3, docPos, offset$1, addSegment) {
313994
+ #walkNode(node3, docPos, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
313899
313995
  if (node3.isText) {
313996
+ if (searchModel === "visible" && hasTrackDeleteMark$1(node3)) {
313997
+ if (context?.deletionBarrierActive)
313998
+ return offset$1;
313999
+ addSegment({
314000
+ offsetStart: offset$1,
314001
+ offsetEnd: offset$1 + 1,
314002
+ docFrom: docPos,
314003
+ docTo: docPos,
314004
+ kind: "atom"
314005
+ });
314006
+ if (context)
314007
+ context.deletionBarrierActive = true;
314008
+ return offset$1 + 1;
314009
+ }
313900
314010
  const text5 = node3.text || "";
313901
314011
  if (text5.length > 0) {
314012
+ if (context && searchModel === "visible")
314013
+ context.deletionBarrierActive = false;
313902
314014
  addSegment({
313903
314015
  offsetStart: offset$1,
313904
314016
  offsetEnd: offset$1 + text5.length,
@@ -313911,6 +314023,8 @@ function print() { __p += __j.call(arguments, '') }
313911
314023
  return offset$1;
313912
314024
  }
313913
314025
  if (node3.isLeaf) {
314026
+ if (context && searchModel === "visible")
314027
+ context.deletionBarrierActive = false;
313914
314028
  if (node3.type.name === "hard_break") {
313915
314029
  addSegment({
313916
314030
  offsetStart: offset$1,
@@ -313930,17 +314044,18 @@ function print() { __p += __j.call(arguments, '') }
313930
314044
  });
313931
314045
  return offset$1 + 1;
313932
314046
  }
313933
- return this.#walkNodeContent(node3, docPos + 1, offset$1, addSegment);
314047
+ return this.#walkNodeContent(node3, docPos + 1, offset$1, addSegment, searchModel, context);
313934
314048
  }
313935
314049
  invalidate() {
313936
314050
  this.valid = false;
313937
314051
  }
313938
- isStale(doc$12) {
313939
- return !this.valid || this.doc !== doc$12;
314052
+ isStale(doc$12, options = {}) {
314053
+ const searchModel = options?.searchModel === "visible" ? "visible" : DEFAULT_SEARCH_MODEL$1;
314054
+ return !this.valid || this.doc !== doc$12 || this.searchModel !== searchModel;
313940
314055
  }
313941
- ensureValid(doc$12) {
313942
- if (this.isStale(doc$12))
313943
- this.build(doc$12);
314056
+ ensureValid(doc$12, options = {}) {
314057
+ if (this.isStale(doc$12, options))
314058
+ this.build(doc$12, options);
313944
314059
  }
313945
314060
  offsetRangeToDocRanges(start$1, end$1) {
313946
314061
  const ranges = [];
@@ -314090,7 +314205,8 @@ function print() { __p += __j.call(arguments, '') }
314090
314205
  activeMatchIndex: -1,
314091
314206
  query: "",
314092
314207
  caseSensitive: false,
314093
- ignoreDiacritics: false
314208
+ ignoreDiacritics: false,
314209
+ searchModel: DEFAULT_SEARCH_MODEL
314094
314210
  };
314095
314211
  },
314096
314212
  addPmPlugins() {
@@ -314104,8 +314220,11 @@ function print() { __p += __j.call(arguments, '') }
314104
314220
  if (storage?.searchIndex)
314105
314221
  storage.searchIndex.invalidate();
314106
314222
  if (storage?.query) {
314107
- storage.searchIndex.ensureValid(newState.doc);
314108
- const indexMatches = (storage.ignoreDiacritics ? (q$1, opts) => storage.searchIndex.searchIgnoringDiacritics(q$1, opts) : (q$1, opts) => storage.searchIndex.search(q$1, opts))(storage.query, { caseSensitive: storage.caseSensitive });
314223
+ storage.searchIndex.ensureValid(newState.doc, { searchModel: storage.searchModel ?? DEFAULT_SEARCH_MODEL });
314224
+ const indexMatches = (storage.ignoreDiacritics ? (q$1, opts) => storage.searchIndex.searchIgnoringDiacritics(q$1, opts) : (q$1, opts) => storage.searchIndex.search(q$1, opts))(storage.query, {
314225
+ caseSensitive: storage.caseSensitive,
314226
+ searchModel: storage.searchModel ?? DEFAULT_SEARCH_MODEL
314227
+ });
314109
314228
  const refreshed = mapIndexMatchesToDocMatches({
314110
314229
  searchIndex: storage.searchIndex,
314111
314230
  indexMatches,
@@ -314203,11 +314322,12 @@ function print() { __p += __j.call(arguments, '') }
314203
314322
  } catch {}
314204
314323
  return true;
314205
314324
  },
314206
- search: (patternInput, options = {}) => ({ state, dispatch, editor }) => {
314325
+ search: (patternInput, options = {}) => ({ state, editor }) => {
314207
314326
  if (options != null && (typeof options !== "object" || Array.isArray(options)))
314208
314327
  throw new TypeError("Search options must be an object");
314209
314328
  const highlight = typeof options?.highlight === "boolean" ? options.highlight : true;
314210
314329
  const maxMatches = typeof options?.maxMatches === "number" ? options.maxMatches : 1000;
314330
+ const searchModel = normalizeSearchModel(options?.searchModel);
314211
314331
  let caseSensitive = false;
314212
314332
  let searchPattern = patternInput;
314213
314333
  if (isRegExp2(patternInput)) {
@@ -314224,12 +314344,14 @@ function print() { __p += __j.call(arguments, '') }
314224
314344
  const positionTracker = getPositionTracker(editor);
314225
314345
  positionTracker?.untrackByType?.(SEARCH_POSITION_TRACKER_TYPE);
314226
314346
  const searchIndex = this.storage.searchIndex;
314227
- searchIndex.ensureValid(state.doc);
314347
+ searchIndex.ensureValid(state.doc, { searchModel });
314348
+ this.storage.searchModel = searchModel;
314228
314349
  const resultMatches = mapIndexMatchesToDocMatches({
314229
314350
  searchIndex,
314230
314351
  indexMatches: searchIndex.search(searchPattern, {
314231
314352
  caseSensitive,
314232
- maxMatches
314353
+ maxMatches,
314354
+ searchModel
314233
314355
  }),
314234
314356
  doc: state.doc,
314235
314357
  positionTracker
@@ -314274,9 +314396,11 @@ function print() { __p += __j.call(arguments, '') }
314274
314396
  const caseSensitive = options.caseSensitive ?? false;
314275
314397
  const ignoreDiacritics = options.ignoreDiacritics ?? false;
314276
314398
  const highlight = options.highlight ?? true;
314399
+ const searchModel = normalizeSearchModel(options.searchModel);
314277
314400
  this.storage.query = query2;
314278
314401
  this.storage.caseSensitive = caseSensitive;
314279
314402
  this.storage.ignoreDiacritics = ignoreDiacritics;
314403
+ this.storage.searchModel = searchModel;
314280
314404
  const positionTracker = getPositionTracker(editor);
314281
314405
  positionTracker?.untrackByType?.(SEARCH_POSITION_TRACKER_TYPE);
314282
314406
  if (!query2) {
@@ -314289,10 +314413,16 @@ function print() { __p += __j.call(arguments, '') }
314289
314413
  };
314290
314414
  }
314291
314415
  const searchIndex = this.storage.searchIndex;
314292
- searchIndex.ensureValid(state.doc);
314416
+ searchIndex.ensureValid(state.doc, { searchModel });
314293
314417
  const resultMatches = mapIndexMatchesToDocMatches({
314294
314418
  searchIndex,
314295
- indexMatches: ignoreDiacritics ? searchIndex.searchIgnoringDiacritics(query2, { caseSensitive }) : searchIndex.search(query2, { caseSensitive }),
314419
+ indexMatches: ignoreDiacritics ? searchIndex.searchIgnoringDiacritics(query2, {
314420
+ caseSensitive,
314421
+ searchModel
314422
+ }) : searchIndex.search(query2, {
314423
+ caseSensitive,
314424
+ searchModel
314425
+ }),
314296
314426
  doc: state.doc,
314297
314427
  positionTracker
314298
314428
  });
@@ -314312,9 +314442,10 @@ function print() { __p += __j.call(arguments, '') }
314312
314442
  this.storage.query = "";
314313
314443
  this.storage.caseSensitive = false;
314314
314444
  this.storage.ignoreDiacritics = false;
314445
+ this.storage.searchModel = DEFAULT_SEARCH_MODEL;
314315
314446
  return true;
314316
314447
  },
314317
- nextSearchMatch: () => ({ state, editor }) => {
314448
+ nextSearchMatch: () => ({ editor }) => {
314318
314449
  const matches2 = this.storage.searchResults;
314319
314450
  if (!matches2 || matches2.length === 0)
314320
314451
  return {
@@ -314330,7 +314461,7 @@ function print() { __p += __j.call(arguments, '') }
314330
314461
  match: match$1
314331
314462
  };
314332
314463
  },
314333
- previousSearchMatch: () => ({ state, editor }) => {
314464
+ previousSearchMatch: () => ({ editor }) => {
314334
314465
  const matches2 = this.storage.searchResults;
314335
314466
  if (!matches2 || matches2.length === 0)
314336
314467
  return {
@@ -314346,7 +314477,7 @@ function print() { __p += __j.call(arguments, '') }
314346
314477
  match: match$1
314347
314478
  };
314348
314479
  },
314349
- replaceSearchMatch: (replacement) => ({ state, dispatch, editor, commands: commands$1 }) => {
314480
+ replaceSearchMatch: (replacement) => ({ state, dispatch, commands: commands$1 }) => {
314350
314481
  const matches2 = this.storage.searchResults;
314351
314482
  const activeIdx = this.storage.activeMatchIndex;
314352
314483
  if (!matches2 || activeIdx < 0 || activeIdx >= matches2.length)
@@ -314368,7 +314499,8 @@ function print() { __p += __j.call(arguments, '') }
314368
314499
  const result = commands$1.setSearchSession(this.storage.query, {
314369
314500
  caseSensitive: this.storage.caseSensitive,
314370
314501
  ignoreDiacritics: this.storage.ignoreDiacritics,
314371
- highlight: this.storage.highlightEnabled
314502
+ highlight: this.storage.highlightEnabled,
314503
+ searchModel: this.storage.searchModel
314372
314504
  });
314373
314505
  if (result.matches.length > 0) {
314374
314506
  const newIdx = Math.min(activeIdx, result.matches.length - 1);
@@ -333629,7 +333761,7 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
333629
333761
 
333630
333762
  // ../../packages/superdoc/dist/super-editor.es.js
333631
333763
  var init_super_editor_es = __esm(() => {
333632
- init_src_CCV76OsP_es();
333764
+ init_src_BzRjWTpH_es();
333633
333765
  init_SuperConverter_BTy5lByv_es();
333634
333766
  init_jszip_C49i9kUs_es();
333635
333767
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.34",
3
+ "version": "0.8.0-next.35",
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/super-editor": "0.0.1",
30
- "superdoc": "1.29.1"
29
+ "superdoc": "1.29.1",
30
+ "@superdoc/super-editor": "0.0.1"
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.8.0-next.34",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.34",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.34",
40
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.34",
41
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.34"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.35",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.35",
39
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.35",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.35",
41
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.35"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",