@superdoc-dev/cli 0.5.0-next.32 → 0.5.0-next.34

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 +62 -22
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -172583,7 +172583,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
172583
172583
  init_remark_gfm_z_sDF4ss_es();
172584
172584
  });
172585
172585
 
172586
- // ../../packages/superdoc/dist/chunks/src-Cj-jgZJT.es.js
172586
+ // ../../packages/superdoc/dist/chunks/src-CGUGTAQU.es.js
172587
172587
  function deleteProps(obj, propOrProps) {
172588
172588
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
172589
172589
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -183616,11 +183616,13 @@ function getAdjacentLineClientTarget(editor, coords, direction) {
183616
183616
  return null;
183617
183617
  const pmStart = Number(adjacentLine.dataset?.pmStart);
183618
183618
  const pmEnd = Number(adjacentLine.dataset?.pmEnd);
183619
+ const isRtl = adjacentLine.closest?.('[dir="rtl"]') != null;
183619
183620
  return {
183620
183621
  clientY,
183621
183622
  pageIndex: Number.isFinite(pageIndex) ? pageIndex : undefined,
183622
183623
  pmStart: Number.isFinite(pmStart) ? pmStart : undefined,
183623
- pmEnd: Number.isFinite(pmEnd) ? pmEnd : undefined
183624
+ pmEnd: Number.isFinite(pmEnd) ? pmEnd : undefined,
183625
+ isRtl
183624
183626
  };
183625
183627
  }
183626
183628
  function getHitFromLayoutCoords(editor, goalX, clientY, coords, pageIndex) {
@@ -183670,7 +183672,7 @@ function findAdjacentLineElement(currentLine, direction, caretX) {
183670
183672
  return null;
183671
183673
  return findEdgeLineForPage(getPageLineElements(nextPage), direction, caretX);
183672
183674
  }
183673
- function resolvePositionAtGoalX(editor, pmStart, pmEnd, goalX) {
183675
+ function resolvePositionAtGoalX(editor, pmStart, pmEnd, goalX, isRtl = false) {
183674
183676
  const presentationEditor = editor.presentationEditor;
183675
183677
  let bestPos = pmStart;
183676
183678
  let bestDist = Infinity;
@@ -183689,9 +183691,15 @@ function resolvePositionAtGoalX(editor, pmStart, pmEnd, goalX) {
183689
183691
  bestPos = mid;
183690
183692
  }
183691
183693
  if (rect.x < goalX)
183692
- lo = mid + 1;
183694
+ if (isRtl)
183695
+ hi = mid - 1;
183696
+ else
183697
+ lo = mid + 1;
183693
183698
  else if (rect.x > goalX)
183694
- hi = mid - 1;
183699
+ if (isRtl)
183700
+ lo = mid + 1;
183701
+ else
183702
+ hi = mid - 1;
183695
183703
  else
183696
183704
  break;
183697
183705
  }
@@ -214522,10 +214530,19 @@ function layoutParagraphBlock(ctx$1, anchors) {
214522
214530
  remeasuredMarkerInfo = newMeasure.marker;
214523
214531
  }
214524
214532
  }
214533
+ const rawBorderExpansion = computeBorderVerticalExpansion(attrs?.borders);
214534
+ const currentBorderHash = hashBorders(attrs?.borders);
214535
+ const inBorderGroup = currentBorderHash != null && currentBorderHash === ensurePage().lastParagraphBorderHash;
214536
+ const borderExpansion = {
214537
+ top: inBorderGroup ? 0 : rawBorderExpansion.top,
214538
+ bottom: rawBorderExpansion.bottom
214539
+ };
214525
214540
  while (fromLine < lines.length) {
214526
214541
  let state = ensurePage();
214527
214542
  if (state.trailingSpacing == null)
214528
214543
  state.trailingSpacing = 0;
214544
+ if (inBorderGroup && fromLine === 0)
214545
+ state.cursorY -= rawBorderExpansion.bottom;
214529
214546
  if (shouldSuppressOwnSpacing(styleId, contextualSpacing, state.lastParagraphStyleId))
214530
214547
  spacingBefore = 0;
214531
214548
  if (shouldSuppressOwnSpacing(state.lastParagraphStyleId, state.lastParagraphContextualSpacing, styleId)) {
@@ -214539,7 +214556,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
214539
214556
  const prevTrailing = state.trailingSpacing ?? 0;
214540
214557
  const neededSpacingBefore = Math.max(spacingBefore - prevTrailing, 0);
214541
214558
  const pageContentHeight = state.contentBottom - state.topMargin;
214542
- const fullHeight = lines.reduce((sum, line) => sum + (line.lineHeight || 0), 0);
214559
+ const fullHeight = lines.reduce((sum, line) => sum + (line.lineHeight || 0), 0) + borderExpansion.top + borderExpansion.bottom;
214543
214560
  const fitsOnBlankPage = fullHeight + baseSpacingBefore <= pageContentHeight;
214544
214561
  const remainingHeightAfterSpacing = state.contentBottom - (state.cursorY + neededSpacingBefore);
214545
214562
  if (fitsOnBlankPage && state.page.fragments.length > 0 && fullHeight > remainingHeightAfterSpacing) {
@@ -214585,7 +214602,9 @@ function layoutParagraphBlock(ctx$1, anchors) {
214585
214602
  effectiveColumnWidth = narrowestWidth;
214586
214603
  offsetX = narrowestOffsetX;
214587
214604
  }
214588
- const slice2 = sliceLines(lines, fromLine, state.contentBottom - state.cursorY);
214605
+ const borderVertical = borderExpansion.top + borderExpansion.bottom;
214606
+ const availableForSlice = Math.max(0, state.contentBottom - state.cursorY - borderVertical);
214607
+ const slice2 = sliceLines(lines, fromLine, availableForSlice);
214589
214608
  const fragmentHeight = slice2.height;
214590
214609
  const adjustedX = columnX(state.columnIndex) + offsetX + negativeLeftIndent;
214591
214610
  const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
@@ -214595,7 +214614,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
214595
214614
  fromLine,
214596
214615
  toLine: slice2.toLine,
214597
214616
  x: adjustedX,
214598
- y: state.cursorY,
214617
+ y: state.cursorY + borderExpansion.top,
214599
214618
  width: adjustedWidth,
214600
214619
  ...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
214601
214620
  };
@@ -214626,7 +214645,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
214626
214645
  fragment2.x = columnX(state.columnIndex) + offsetX + (effectiveColumnWidth - maxLineWidth) / 2;
214627
214646
  }
214628
214647
  state.page.fragments.push(fragment2);
214629
- state.cursorY += fragmentHeight;
214648
+ state.cursorY += borderExpansion.top + fragmentHeight + borderExpansion.bottom;
214630
214649
  lastState = state;
214631
214650
  fromLine = slice2.toLine;
214632
214651
  }
@@ -214644,6 +214663,7 @@ function layoutParagraphBlock(ctx$1, anchors) {
214644
214663
  lastState.trailingSpacing = 0;
214645
214664
  lastState.lastParagraphStyleId = styleId;
214646
214665
  lastState.lastParagraphContextualSpacing = contextualSpacing;
214666
+ lastState.lastParagraphBorderHash = currentBorderHash;
214647
214667
  }
214648
214668
  }
214649
214669
  function layoutImageBlock({ block, measure, columns, ensurePage, advanceColumn, columnX }) {
@@ -232609,6 +232629,10 @@ var Node$13 = class Node$14 {
232609
232629
  this.dom.classList.remove("sd-editor-dropcap");
232610
232630
  if (paragraphProperties.styleId)
232611
232631
  this.dom.setAttribute("styleid", paragraphProperties.styleId);
232632
+ if (paragraphProperties.rightToLeft)
232633
+ this.dom.setAttribute("dir", "rtl");
232634
+ else
232635
+ this.dom.removeAttribute("dir");
232612
232636
  }
232613
232637
  #updateDOMStyles(oldParagraphProperties = null) {
232614
232638
  this.dom.style.cssText = "";
@@ -240458,7 +240482,7 @@ var Node$13 = class Node$14 {
240458
240482
  if (frag.continuesOnNext)
240459
240483
  continue;
240460
240484
  const borders = getFragmentParagraphBorders(frag, blockLookup);
240461
- if (!borders?.between)
240485
+ if (!borders)
240462
240486
  continue;
240463
240487
  const next2 = fragments[i4 + 1];
240464
240488
  if (next2.kind !== "para" && next2.kind !== "list-item")
@@ -240470,7 +240494,7 @@ var Node$13 = class Node$14 {
240470
240494
  if (next2.blockId === frag.blockId && next2.kind === "list-item" && frag.kind === "list-item" && next2.itemId === frag.itemId)
240471
240495
  continue;
240472
240496
  const nextBorders = getFragmentParagraphBorders(next2, blockLookup);
240473
- if (!nextBorders?.between)
240497
+ if (!nextBorders)
240474
240498
  continue;
240475
240499
  if (hashParagraphBorders$1(borders) !== hashParagraphBorders$1(nextBorders))
240476
240500
  continue;
@@ -240511,7 +240535,7 @@ var Node$13 = class Node$14 {
240511
240535
  result.get(i4 + 1).suppressTopBorder = true;
240512
240536
  }
240513
240537
  return result;
240514
- }, PX_PER_PT$12, getParagraphBorderBox = (fragmentWidth, indent2) => {
240538
+ }, PX_PER_PT$2, getParagraphBorderBox = (fragmentWidth, indent2) => {
240515
240539
  const indentLeft = Number.isFinite(indent2?.left) ? indent2.left : 0;
240516
240540
  const indentRight = Number.isFinite(indent2?.right) ? indent2.right : 0;
240517
240541
  const firstLineOffset = (Number.isFinite(indent2?.firstLine) ? indent2.firstLine : 0) - (Number.isFinite(indent2?.hanging) ? indent2.hanging : 0);
@@ -240534,17 +240558,17 @@ var Node$13 = class Node$14 {
240534
240558
  const suppressBottom = betweenInfo?.suppressBottomBorder ?? false;
240535
240559
  const showBetween = betweenInfo?.showBetweenBorder ?? false;
240536
240560
  return {
240537
- top: suppressTop ? borders.between?.space ? borders.between.space * PX_PER_PT$12 : 0 : borders.top?.space ? borders.top.space * PX_PER_PT$12 : 0,
240538
- bottom: !suppressBottom && !showBetween && borders.bottom?.space ? borders.bottom.space * PX_PER_PT$12 : 0,
240539
- left: borders.left?.space ? borders.left.space * PX_PER_PT$12 : 0,
240540
- right: borders.right?.space ? borders.right.space * PX_PER_PT$12 : 0
240561
+ top: suppressTop ? borders.between?.space ? borders.between.space * PX_PER_PT$2 : 0 : borders.top?.space ? borders.top.space * PX_PER_PT$2 : 0,
240562
+ bottom: !suppressBottom && !showBetween && borders.bottom?.space ? borders.bottom.space * PX_PER_PT$2 : 0,
240563
+ left: borders.left?.space ? borders.left.space * PX_PER_PT$2 : 0,
240564
+ right: borders.right?.space ? borders.right.space * PX_PER_PT$2 : 0
240541
240565
  };
240542
240566
  }, createParagraphDecorationLayers = (doc$12, fragmentWidth, attrs, betweenInfo) => {
240543
240567
  if (!attrs?.borders && !attrs?.shading)
240544
240568
  return {};
240545
240569
  const borderBox = getParagraphBorderBox(fragmentWidth, attrs.indent);
240546
240570
  const space = computeBorderSpaceExpansion(attrs.borders, betweenInfo);
240547
- const betweenSpaceBelow = betweenInfo?.showBetweenBorder && attrs.borders?.between?.space ? attrs.borders.between.space * PX_PER_PT$12 : 0;
240571
+ const betweenSpaceBelow = betweenInfo?.showBetweenBorder && attrs.borders?.between?.space ? attrs.borders.between.space * PX_PER_PT$2 : 0;
240548
240572
  const rawGap = betweenInfo?.showBetweenBorder || betweenInfo?.suppressBottomBorder ? betweenInfo.gapBelow : 0;
240549
240573
  const gapExtension = Math.max(0, rawGap - betweenSpaceBelow);
240550
240574
  const bw = computeRenderedBorderWidths(attrs.borders, betweenInfo);
@@ -246334,7 +246358,7 @@ var Node$13 = class Node$14 {
246334
246358
  pmStart: start$1,
246335
246359
  pmEnd: (typeof attrs.pmEnd === "number" ? attrs.pmEnd : undefined) ?? (start$1 != null ? start$1 + 1 : undefined)
246336
246360
  };
246337
- }, getParagraphAttrs = (block) => {
246361
+ }, PX_PER_PT$12, getParagraphAttrs = (block) => {
246338
246362
  if (!block.attrs || typeof block.attrs !== "object")
246339
246363
  return;
246340
246364
  return block.attrs;
@@ -246354,6 +246378,21 @@ var Node$13 = class Node$14 {
246354
246378
  if (!Number.isFinite(value) || value < 0)
246355
246379
  return 0;
246356
246380
  return value;
246381
+ }, hashBorders = (borders) => {
246382
+ if (!borders)
246383
+ return;
246384
+ const side = (b$1) => b$1 ? `${b$1.style ?? ""},${b$1.width ?? 0},${b$1.color ?? ""},${b$1.space ?? 0}` : "";
246385
+ return `${side(borders.top)}|${side(borders.right)}|${side(borders.bottom)}|${side(borders.left)}|${side(borders.between)}`;
246386
+ }, computeBorderVerticalExpansion = (borders) => {
246387
+ if (!borders)
246388
+ return {
246389
+ top: 0,
246390
+ bottom: 0
246391
+ };
246392
+ return {
246393
+ top: (borders.top?.space ?? 0) * PX_PER_PT$12 + (borders.top?.width ?? 0),
246394
+ bottom: (borders.bottom?.space ?? 0) * PX_PER_PT$12 + (borders.bottom?.width ?? 0)
246395
+ };
246357
246396
  }, 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, getColumnWidthAt = (columns, columnIndex) => {
246358
246397
  if (Array.isArray(columns.widths) && columns.widths.length > 0)
246359
246398
  return columns.widths[Math.max(0, Math.min(columnIndex, columns.widths.length - 1))] ?? columns.width;
@@ -255273,7 +255312,7 @@ var Node$13 = class Node$14 {
255273
255312
  return;
255274
255313
  console.log(...args$1);
255275
255314
  }, 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;
255276
- var init_src_Cj_jgZJT_es = __esm(() => {
255315
+ var init_src_CGUGTAQU_es = __esm(() => {
255277
255316
  init_rolldown_runtime_B2q5OVn9_es();
255278
255317
  init_SuperConverter_B9oNf3OB_es();
255279
255318
  init_jszip_ChlR43oI_es();
@@ -273556,7 +273595,7 @@ function print() { __p += __j.call(arguments, '') }
273556
273595
  outline-offset: 2px;
273557
273596
  }
273558
273597
  `;
273559
- PX_PER_PT$12 = 96 / 72;
273598
+ PX_PER_PT$2 = 96 / 72;
273560
273599
  BORDER_SIDES3 = [
273561
273600
  "top",
273562
273601
  "right",
@@ -277450,7 +277489,7 @@ function print() { __p += __j.call(arguments, '') }
277450
277489
  const TOLERANCE = 5;
277451
277490
  const hitPos = hit?.pos;
277452
277491
  if (!hit || !Number.isFinite(hitPos) || hitPos < adjacent.pmStart - TOLERANCE || hitPos > adjacent.pmEnd + TOLERANCE)
277453
- hit = resolvePositionAtGoalX(editor, adjacent.pmStart, adjacent.pmEnd, goalX);
277492
+ hit = resolvePositionAtGoalX(editor, adjacent.pmStart, adjacent.pmEnd, goalX, adjacent.isRtl);
277454
277493
  }
277455
277494
  if (!hit || !Number.isFinite(hit.pos))
277456
277495
  return false;
@@ -284723,6 +284762,7 @@ function print() { __p += __j.call(arguments, '') }
284723
284762
  count: 1,
284724
284763
  gap: 0
284725
284764
  };
284765
+ PX_PER_PT$12 = 96 / 72;
284726
284766
  DEFAULT_BALANCING_CONFIG = {
284727
284767
  enabled: true,
284728
284768
  tolerance: 5,
@@ -289760,7 +289800,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
289760
289800
 
289761
289801
  // ../../packages/superdoc/dist/super-editor.es.js
289762
289802
  var init_super_editor_es = __esm(() => {
289763
- init_src_Cj_jgZJT_es();
289803
+ init_src_CGUGTAQU_es();
289764
289804
  init_SuperConverter_B9oNf3OB_es();
289765
289805
  init_jszip_ChlR43oI_es();
289766
289806
  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.32",
3
+ "version": "0.5.0-next.34",
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
+ "@superdoc/super-editor": "0.0.1",
29
29
  "superdoc": "1.23.0",
30
- "@superdoc/super-editor": "0.0.1"
30
+ "@superdoc/pm-adapter": "0.0.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.32",
38
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.32",
39
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.32",
40
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.32",
41
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.32"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.34",
38
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.34",
39
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.34",
40
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.34",
41
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.34"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",