@superdoc-dev/cli 0.5.0-next.5 → 0.5.0-next.7

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 +87 -17
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -171536,7 +171536,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
171536
171536
  init_remark_gfm_z_sDF4ss_es();
171537
171537
  });
171538
171538
 
171539
- // ../../packages/superdoc/dist/chunks/src-JYX7HxB3.es.js
171539
+ // ../../packages/superdoc/dist/chunks/src-D9hI0nIy.es.js
171540
171540
  function deleteProps(obj, propOrProps) {
171541
171541
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
171542
171542
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -238367,6 +238367,14 @@ var Node$13 = class Node$14 {
238367
238367
  left: borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV),
238368
238368
  right: borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders?.right : null)
238369
238369
  };
238370
+ }, swapCellBordersLR = (borders) => {
238371
+ if (!borders)
238372
+ return;
238373
+ return {
238374
+ ...borders,
238375
+ left: borders.right,
238376
+ right: borders.left
238377
+ };
238370
238378
  }, applyInlineStyles = (el, styles) => {
238371
238379
  Object.entries(styles).forEach(([key$1, value]) => {
238372
238380
  if (value != null && value !== "" && key$1 in el.style)
@@ -238415,16 +238423,16 @@ var Node$13 = class Node$14 {
238415
238423
  applyStyles: applyInlineStyles
238416
238424
  });
238417
238425
  }, renderTableCell = (deps) => {
238418
- const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine, captureLineSnapshot, renderDrawingContent, context, applySdtDataset, tableSdt, tableIndent, cellWidth, fromLine, toLine } = deps;
238426
+ const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine, captureLineSnapshot, renderDrawingContent, context, applySdtDataset, tableSdt, tableIndent, isRtl, cellWidth, fromLine, toLine } = deps;
238419
238427
  const padding = cell2?.attrs?.padding || {
238420
238428
  top: 0,
238421
238429
  left: 4,
238422
238430
  right: 4,
238423
238431
  bottom: 0
238424
238432
  };
238425
- const paddingLeft = padding.left ?? 4;
238433
+ const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
238426
238434
  const paddingTop = padding.top ?? 0;
238427
- const paddingRight = padding.right ?? 4;
238435
+ const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
238428
238436
  const paddingBottom = padding.bottom ?? 0;
238429
238437
  const cellEl = doc$12.createElement("div");
238430
238438
  cellEl.style.position = "absolute";
@@ -238923,7 +238931,7 @@ var Node$13 = class Node$14 {
238923
238931
  left: baseBorders.left
238924
238932
  };
238925
238933
  }, renderTableRow = (deps) => {
238926
- const { doc: doc$12, 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;
238934
+ const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, tableSdt, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0 } = deps;
238927
238935
  const totalCols = columnWidths.length;
238928
238936
  const calculateXPosition = (gridColumnStart) => {
238929
238937
  let x = cellSpacingPx;
@@ -238931,6 +238939,12 @@ var Node$13 = class Node$14 {
238931
238939
  x += columnWidths[i4] + cellSpacingPx;
238932
238940
  return x;
238933
238941
  };
238942
+ let tableContentWidth = 0;
238943
+ if (isRtl) {
238944
+ tableContentWidth = cellSpacingPx;
238945
+ for (let i4 = 0;i4 < columnWidths.length; i4++)
238946
+ tableContentWidth += columnWidths[i4] + cellSpacingPx;
238947
+ }
238934
238948
  const calculateRowspanHeight = (startRowIndex, rowSpan) => {
238935
238949
  let totalHeight = 0;
238936
238950
  for (let i4 = 0;i4 < rowSpan && startRowIndex + i4 < allRowHeights.length; i4++)
@@ -238949,7 +238963,7 @@ var Node$13 = class Node$14 {
238949
238963
  const gridColumnStart = cellMeasure.gridColumnStart ?? cellIndex;
238950
238964
  const rowSpan = cellMeasure.rowSpan ?? 1;
238951
238965
  const colSpan = cellMeasure.colSpan ?? 1;
238952
- const x = calculateXPosition(gridColumnStart);
238966
+ let x = calculateXPosition(gridColumnStart);
238953
238967
  const cellBordersAttr = cell2?.attrs?.borders;
238954
238968
  const resolvedBorders = resolveRenderedCellBorders({
238955
238969
  cellBorders: cellBordersAttr,
@@ -238967,6 +238981,7 @@ var Node$13 = class Node$14 {
238967
238981
  continuesFromPrev: continuesFromPrev === true,
238968
238982
  continuesOnNext: continuesOnNext === true
238969
238983
  });
238984
+ const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
238970
238985
  let cellHeight;
238971
238986
  if (partialRow)
238972
238987
  cellHeight = partialRow.partialHeight;
@@ -238977,6 +238992,8 @@ var Node$13 = class Node$14 {
238977
238992
  const fromLine = partialRow?.fromLineByCell?.[cellIndex];
238978
238993
  const toLine = partialRow?.toLineByCell?.[cellIndex];
238979
238994
  const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
238995
+ if (isRtl && computedCellWidth > 0)
238996
+ x = tableContentWidth - x - computedCellWidth;
238980
238997
  const { cellElement } = renderTableCell({
238981
238998
  doc: doc$12,
238982
238999
  x,
@@ -238984,7 +239001,7 @@ var Node$13 = class Node$14 {
238984
239001
  rowHeight: cellHeight,
238985
239002
  cellMeasure,
238986
239003
  cell: cell2,
238987
- borders: resolvedBorders,
239004
+ borders: finalBorders,
238988
239005
  useDefaultBorder: false,
238989
239006
  renderLine,
238990
239007
  captureLineSnapshot,
@@ -238995,6 +239012,7 @@ var Node$13 = class Node$14 {
238995
239012
  fromLine,
238996
239013
  toLine,
238997
239014
  tableIndent,
239015
+ isRtl,
238998
239016
  cellWidth: computedCellWidth > 0 ? computedCellWidth : undefined
238999
239017
  });
239000
239018
  container.appendChild(cellElement);
@@ -239032,6 +239050,7 @@ var Node$13 = class Node$14 {
239032
239050
  const tableBorders = block.attrs?.borders;
239033
239051
  const tableIndentValue = block.attrs?.tableIndent?.width;
239034
239052
  const tableIndent = typeof tableIndentValue === "number" && Number.isFinite(tableIndentValue) ? tableIndentValue : 0;
239053
+ const isRtl = block.attrs?.tableProperties?.rightToLeft === true;
239035
239054
  const container = doc$12.createElement("div");
239036
239055
  container.classList.add(CLASS_NAMES$1.fragment);
239037
239056
  applyStyles$2(container, fragmentStyles);
@@ -239132,9 +239151,9 @@ var Node$13 = class Node$14 {
239132
239151
  container.setAttribute("data-sd-block-id", block.id);
239133
239152
  if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && block.attrs?.cellSpacing && tableBorders) {
239134
239153
  applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
239135
- applyBorder(container, "Right", borderValueToSpec(tableBorders.right));
239154
+ applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
239136
239155
  applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
239137
- applyBorder(container, "Left", borderValueToSpec(tableBorders.left));
239156
+ applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
239138
239157
  }
239139
239158
  const allRowHeights = measure.rows.map((r$1, idx) => {
239140
239159
  if (fragment2.partialRow && fragment2.partialRow.rowIndex === idx)
@@ -239159,6 +239178,7 @@ var Node$13 = class Node$14 {
239159
239178
  columnWidths: effectiveColumnWidths,
239160
239179
  allRowHeights,
239161
239180
  tableIndent,
239181
+ isRtl,
239162
239182
  context,
239163
239183
  renderLine,
239164
239184
  captureLineSnapshot,
@@ -239193,6 +239213,15 @@ var Node$13 = class Node$14 {
239193
239213
  let ghostWidth = 0;
239194
239214
  for (let i4 = gridCol;i4 < gridCol + colSpan && i4 < effectiveColumnWidths.length; i4++)
239195
239215
  ghostWidth += effectiveColumnWidths[i4];
239216
+ if (isRtl && ghostWidth > 0) {
239217
+ let totalWidth = cellSpacingPx;
239218
+ for (let i4 = 0;i4 < effectiveColumnWidths.length; i4++)
239219
+ totalWidth += effectiveColumnWidths[i4] + cellSpacingPx;
239220
+ let ghostXWithSpacing = cellSpacingPx;
239221
+ for (let i4 = 0;i4 < gridCol && i4 < effectiveColumnWidths.length; i4++)
239222
+ ghostXWithSpacing += effectiveColumnWidths[i4] + cellSpacingPx;
239223
+ ghostX = totalWidth - ghostXWithSpacing - ghostWidth;
239224
+ }
239196
239225
  const effectiveEnd = Math.min(spanEndRow, fragment2.toRow);
239197
239226
  let ghostHeight = 0;
239198
239227
  for (let ri = fragment2.fromRow;ri < effectiveEnd; ri++)
@@ -239220,11 +239249,20 @@ var Node$13 = class Node$14 {
239220
239249
  });
239221
239250
  const cellEndsWithinFragment = effectiveEnd <= fragment2.toRow && spanEndRow <= fragment2.toRow;
239222
239251
  if (tableBorders) {
239223
- applyBorder(ghostDiv, "Top", (explicit ? cellBordersAttr.top : undefined) ?? borderValueToSpec(tableBorders.top));
239224
- applyBorder(ghostDiv, "Left", (explicit ? cellBordersAttr.left : undefined) ?? borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV));
239225
- applyBorder(ghostDiv, "Right", (explicit ? cellBordersAttr.right : undefined) ?? borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders.right : tableBorders.insideV));
239226
- if (cellEndsWithinFragment)
239227
- applyBorder(ghostDiv, "Bottom", (explicit ? cellBordersAttr.bottom : undefined) ?? borderValueToSpec(cellBounds.touchesBottomEdge ? tableBorders.bottom : tableBorders.insideH));
239252
+ const topB = (explicit ? cellBordersAttr.top : undefined) ?? borderValueToSpec(tableBorders.top);
239253
+ let leftB = (explicit ? cellBordersAttr.left : undefined) ?? borderValueToSpec(cellBounds.touchesLeftEdge ? tableBorders.left : tableBorders.insideV);
239254
+ let rightB = (explicit ? cellBordersAttr.right : undefined) ?? borderValueToSpec(cellBounds.touchesRightEdge ? tableBorders.right : tableBorders.insideV);
239255
+ const bottomB = cellEndsWithinFragment ? (explicit ? cellBordersAttr.bottom : undefined) ?? borderValueToSpec(cellBounds.touchesBottomEdge ? tableBorders.bottom : tableBorders.insideH) : undefined;
239256
+ if (isRtl) {
239257
+ const tmp = leftB;
239258
+ leftB = rightB;
239259
+ rightB = tmp;
239260
+ }
239261
+ applyBorder(ghostDiv, "Top", topB);
239262
+ applyBorder(ghostDiv, "Left", leftB);
239263
+ applyBorder(ghostDiv, "Right", rightB);
239264
+ if (bottomB)
239265
+ applyBorder(ghostDiv, "Bottom", bottomB);
239228
239266
  }
239229
239267
  if (srcCell?.attrs?.background)
239230
239268
  ghostDiv.style.backgroundColor = srcCell.attrs.background;
@@ -239252,6 +239290,7 @@ var Node$13 = class Node$14 {
239252
239290
  columnWidths: effectiveColumnWidths,
239253
239291
  allRowHeights,
239254
239292
  tableIndent,
239293
+ isRtl,
239255
239294
  context,
239256
239295
  renderLine,
239257
239296
  captureLineSnapshot,
@@ -252291,7 +252330,7 @@ var Node$13 = class Node$14 {
252291
252330
  return;
252292
252331
  console.log(...args$1);
252293
252332
  }, 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;
252294
- var init_src_JYX7HxB3_es = __esm(() => {
252333
+ var init_src_D9hI0nIy_es = __esm(() => {
252295
252334
  init_rolldown_runtime_B2q5OVn9_es();
252296
252335
  init_SuperConverter_CXcZg9Os_es();
252297
252336
  init_jszip_ChlR43oI_es();
@@ -254303,6 +254342,16 @@ ${err.toString()}`);
254303
254342
  content3 = schema.nodeFromJSON(options.json);
254304
254343
  if (!content3)
254305
254344
  content3 = schema.text(" ");
254345
+ const runType = schema.nodes.run;
254346
+ if (runType && !options.json && content3.isText) {
254347
+ const formattingState = getFormattingStateAtPos(state, from$1, editor, { storedMarks: state.storedMarks || null });
254348
+ const runProperties = formattingState.inlineRunProperties || null;
254349
+ if (formattingState.resolvedMarks?.length) {
254350
+ const mergedMarks = formattingState.resolvedMarks.reduce((set, mark2) => mark2.addToSet(set), content3.marks);
254351
+ content3 = content3.mark(mergedMarks);
254352
+ }
254353
+ content3 = runType.create({ runProperties }, content3);
254354
+ }
254306
254355
  let tag = options.attrs?.tag || "inline_text_sdt";
254307
254356
  if (options.attrs?.group)
254308
254357
  tag = createTagObject({ group: options.attrs.group });
@@ -254317,7 +254366,28 @@ ${err.toString()}`);
254317
254366
  const parent = findParentNode((node$1) => node$1.type.name === "structuredContent")(state.selection);
254318
254367
  if (parent)
254319
254368
  from$1 = to = parent.pos + parent.node.nodeSize;
254320
- tr.replaceWith(from$1, to, node3);
254369
+ const $from = state.doc.resolve(from$1);
254370
+ const $to = from$1 === to ? $from : state.doc.resolve(to);
254371
+ if (runType && $from.parent.type === runType && $from.parent === $to.parent) {
254372
+ const runDepth = $from.depth;
254373
+ const runStart = $from.before(runDepth);
254374
+ const runEnd = $from.after(runDepth);
254375
+ const parentRun = $from.parent;
254376
+ const startOffset = $from.parentOffset;
254377
+ const endOffset = $to.parentOffset;
254378
+ const leftContent = parentRun.content.cut(0, startOffset);
254379
+ const rightContent = parentRun.content.cut(endOffset);
254380
+ const fragments = [];
254381
+ if (leftContent.size > 0)
254382
+ fragments.push(runType.create(parentRun.attrs, leftContent, parentRun.marks));
254383
+ fragments.push(node3);
254384
+ if (rightContent.size > 0)
254385
+ fragments.push(runType.create(parentRun.attrs, rightContent, parentRun.marks));
254386
+ tr.replaceWith(runStart, runEnd, fragments);
254387
+ const cursorPos = runStart + (leftContent.size > 0 ? leftContent.size + 2 : 0) + node3.nodeSize;
254388
+ tr.setSelection(TextSelection2.create(tr.doc, cursorPos));
254389
+ } else
254390
+ tr.replaceWith(from$1, to, node3);
254321
254391
  }
254322
254392
  return true;
254323
254393
  },
@@ -285775,7 +285845,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
285775
285845
 
285776
285846
  // ../../packages/superdoc/dist/super-editor.es.js
285777
285847
  var init_super_editor_es = __esm(() => {
285778
- init_src_JYX7HxB3_es();
285848
+ init_src_D9hI0nIy_es();
285779
285849
  init_SuperConverter_CXcZg9Os_es();
285780
285850
  init_jszip_ChlR43oI_es();
285781
285851
  init_xml_js_40FWvL78_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.5.0-next.5",
3
+ "version": "0.5.0-next.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,20 +25,20 @@
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
+ "@superdoc/pm-adapter": "0.0.0",
28
29
  "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.23.0",
30
- "@superdoc/pm-adapter": "0.0.0"
30
+ "superdoc": "1.23.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.5",
38
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.5",
39
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.5",
40
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.5",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.5"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.7",
38
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.7",
39
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.7",
40
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.7",
41
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.7"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",