@superdoc-dev/cli 0.8.0-next.100 → 0.8.0-next.102

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 +318 -79
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -66095,7 +66095,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
66095
66095
  emptyOptions2 = {};
66096
66096
  });
66097
66097
 
66098
- // ../../packages/superdoc/dist/chunks/SuperConverter-B1Huzhur.es.js
66098
+ // ../../packages/superdoc/dist/chunks/SuperConverter-5Idv4fhC.es.js
66099
66099
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
66100
66100
  const fieldValue = extension$1.config[field];
66101
66101
  if (typeof fieldValue === "function")
@@ -84544,6 +84544,15 @@ function calculateResolvedParagraphProperties(editor, node3, $pos) {
84544
84544
  resolvedParagraphPropertiesCache.set(node3, paragraphProperties);
84545
84545
  return paragraphProperties;
84546
84546
  }
84547
+ function resolveHypotheticalParagraphProperties(editor, $pos, inlineProps) {
84548
+ if (!editor?.converter)
84549
+ return inlineProps;
84550
+ const tableStyleId = findParentNodeClosestToPos($pos, (node3) => node3.type.name === "table")?.node.attrs.tableStyleId || null;
84551
+ return resolveParagraphProperties({
84552
+ translatedNumbering: editor.converter.translatedNumbering,
84553
+ translatedLinkedStyles: editor.converter.translatedLinkedStyles
84554
+ }, inlineProps, tableStyleId);
84555
+ }
84547
84556
  function getRunContext($pos) {
84548
84557
  let paragraphNode = null;
84549
84558
  let paragraphDepth = -1;
@@ -119539,7 +119548,7 @@ var isRegExp = (value) => {
119539
119548
  state.kern = kernNode.attributes["w:val"];
119540
119549
  }
119541
119550
  }, SuperConverter;
119542
- var init_SuperConverter_B1Huzhur_es = __esm(() => {
119551
+ var init_SuperConverter_5Idv4fhC_es = __esm(() => {
119543
119552
  init_rolldown_runtime_Bg48TavK_es();
119544
119553
  init_jszip_C49i9kUs_es();
119545
119554
  init_xml_js_CqGKpaft_es();
@@ -157408,7 +157417,7 @@ var init_SuperConverter_B1Huzhur_es = __esm(() => {
157408
157417
  };
157409
157418
  });
157410
157419
 
157411
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B1ifCjiq.es.js
157420
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CEUTigkM.es.js
157412
157421
  function parseSizeUnit(val = "0") {
157413
157422
  const length3 = val.toString() || "0";
157414
157423
  const value = Number.parseFloat(length3);
@@ -159661,6 +159670,27 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
159661
159670
  }, getCurrentParagraphJustification = (context) => {
159662
159671
  const paragraphProperties = getCurrentResolvedParagraphProperties(context);
159663
159672
  return mapStoredJustificationToDisplayAlignment(paragraphProperties?.justification ?? null, paragraphProperties?.rightToLeft === true);
159673
+ }, createParagraphDirectionStateDeriver = (direction) => ({ context }) => {
159674
+ if (isCommandDisabled(context))
159675
+ return {
159676
+ active: false,
159677
+ disabled: true,
159678
+ value: null
159679
+ };
159680
+ const current = getCurrentResolvedParagraphProperties(context)?.rightToLeft ? "rtl" : "ltr";
159681
+ return {
159682
+ active: current === direction,
159683
+ disabled: false,
159684
+ value: current
159685
+ };
159686
+ }, createParagraphDirectionExecute = (direction) => ({ context }) => {
159687
+ const command = resolveStateEditor(context)?.commands.setParagraphDirection;
159688
+ if (typeof command !== "function")
159689
+ return false;
159690
+ return Boolean(command({
159691
+ direction,
159692
+ alignmentPolicy: "matchDirection"
159693
+ }));
159664
159694
  }, createTextAlignStateDeriver = () => ({ context }) => {
159665
159695
  if (isCommandDisabled(context))
159666
159696
  return {
@@ -159900,6 +159930,18 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
159900
159930
  state: createDisabledStateDeriver(),
159901
159931
  execute: createIndentDecreaseExecute()
159902
159932
  },
159933
+ "direction-ltr": {
159934
+ id: "direction-ltr",
159935
+ directCommandName: "setParagraphDirection",
159936
+ state: createParagraphDirectionStateDeriver("ltr"),
159937
+ execute: createParagraphDirectionExecute("ltr")
159938
+ },
159939
+ "direction-rtl": {
159940
+ id: "direction-rtl",
159941
+ directCommandName: "setParagraphDirection",
159942
+ state: createParagraphDirectionStateDeriver("rtl"),
159943
+ execute: createParagraphDirectionExecute("rtl")
159944
+ },
159903
159945
  undo: {
159904
159946
  id: "undo",
159905
159947
  directCommandName: "undo",
@@ -160097,8 +160139,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
160097
160139
  }
160098
160140
  };
160099
160141
  };
160100
- var init_create_headless_toolbar_B1ifCjiq_es = __esm(() => {
160101
- init_SuperConverter_B1Huzhur_es();
160142
+ var init_create_headless_toolbar_CEUTigkM_es = __esm(() => {
160143
+ init_SuperConverter_5Idv4fhC_es();
160102
160144
  init_constants_DrU4EASo_es();
160103
160145
  init_dist_B8HfvhaK_es();
160104
160146
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -208795,7 +208837,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208795
208837
  init_remark_gfm_BhnWr3yf_es();
208796
208838
  });
208797
208839
 
208798
- // ../../packages/superdoc/dist/chunks/src-BiYFxw9u.es.js
208840
+ // ../../packages/superdoc/dist/chunks/src-OZOxpRA7.es.js
208799
208841
  function deleteProps(obj, propOrProps) {
208800
208842
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208801
208843
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -209040,6 +209082,16 @@ function calculateTabWidth(params$1) {
209040
209082
  tabStopPosUsed: nextStop.pos
209041
209083
  };
209042
209084
  }
209085
+ function getParagraphInlineDirection(attrs) {
209086
+ const fromContext = attrs?.directionContext?.inlineDirection;
209087
+ if (fromContext != null)
209088
+ return fromContext;
209089
+ const ppRtl = attrs?.paragraphProperties?.rightToLeft;
209090
+ if (attrs?.direction === "rtl" || attrs?.dir === "rtl" || attrs?.rtl === true || ppRtl === true)
209091
+ return "rtl";
209092
+ if (attrs?.direction === "ltr" || attrs?.dir === "ltr" || attrs?.rtl === false || ppRtl === false)
209093
+ return "ltr";
209094
+ }
209043
209095
  function resolveTableWidthAttr(value) {
209044
209096
  if (!value || typeof value !== "object")
209045
209097
  return null;
@@ -211670,6 +211722,44 @@ function modifyIndentation(calcFunc, { resolveProps = false } = {}) {
211670
211722
  return success;
211671
211723
  };
211672
211724
  }
211725
+ function walkParagraphs$1(transform) {
211726
+ return ({ editor, state, dispatch }) => {
211727
+ const { from: from$1, to } = state.selection;
211728
+ const tr = state.tr;
211729
+ let touched = false;
211730
+ state.doc.nodesBetween(from$1, to, (node3, pos) => {
211731
+ if (node3.type.name !== "paragraph")
211732
+ return true;
211733
+ const existing = node3.attrs.paragraphProperties || {};
211734
+ const updated = transform(existing, {
211735
+ editor,
211736
+ node: node3,
211737
+ $pos: state.doc.resolve(pos)
211738
+ });
211739
+ if (shallowEqual$2(existing, updated))
211740
+ return false;
211741
+ tr.setNodeMarkup(pos, undefined, {
211742
+ ...node3.attrs,
211743
+ paragraphProperties: updated
211744
+ });
211745
+ touched = true;
211746
+ return false;
211747
+ });
211748
+ if (touched && dispatch)
211749
+ dispatch(tr);
211750
+ return touched;
211751
+ };
211752
+ }
211753
+ function shallowEqual$2(a2, b$1) {
211754
+ const ka = Object.keys(a2);
211755
+ const kb = Object.keys(b$1);
211756
+ if (ka.length !== kb.length)
211757
+ return false;
211758
+ for (const k$1 of ka)
211759
+ if (a2[k$1] !== b$1[k$1])
211760
+ return false;
211761
+ return true;
211762
+ }
211673
211763
  function deleteFromEndOfRun(state, dispatch, $pos) {
211674
211764
  const rightRun = state.doc.nodeAt($pos.pos + 1);
211675
211765
  const $afterRightRunPos = state.doc.resolve($pos.pos + 2 + rightRun.nodeSize);
@@ -212645,7 +212735,7 @@ function isListParagraph(node3) {
212645
212735
  return node3?.type?.name === "paragraph" && node3.attrs?.paragraphProperties?.numberingProperties && node3.attrs?.listRendering;
212646
212736
  }
212647
212737
  function isRtlParagraph$1(node3) {
212648
- return node3?.attrs?.paragraphProperties?.rightToLeft === true || node3?.attrs?.direction === "rtl" || node3?.attrs?.rtl === true;
212738
+ return getParagraphInlineDirection(node3?.attrs) === "rtl";
212649
212739
  }
212650
212740
  function getParagraphContext$1($pos) {
212651
212741
  for (let depth = $pos.depth;depth >= 0; depth--) {
@@ -213491,6 +213581,9 @@ function getTableContext($head) {
213491
213581
  table: table2
213492
213582
  };
213493
213583
  }
213584
+ function isRtlTable(table2) {
213585
+ return table2?.attrs?.tableProperties?.rightToLeft === true;
213586
+ }
213494
213587
  function getCellRect(context) {
213495
213588
  const map$12 = TableMap.get(context.table);
213496
213589
  return {
@@ -213498,6 +213591,9 @@ function getCellRect(context) {
213498
213591
  rect: map$12.findCell(context.cellStart - context.tableStart)
213499
213592
  };
213500
213593
  }
213594
+ function getEffectiveTableDir(table2, dir) {
213595
+ return isRtlTable(table2) ? -dir : dir;
213596
+ }
213501
213597
  function isLastCellInTable(context) {
213502
213598
  if (!context)
213503
213599
  return false;
@@ -213589,7 +213685,8 @@ function getTableBoundaryExitSelection(state, dir) {
213589
213685
  const context = getTableContext(selection.$head);
213590
213686
  if (!context)
213591
213687
  return null;
213592
- const helpers = getDirectionHelpers(dir);
213688
+ const effectiveDir = getEffectiveTableDir(context.table, dir);
213689
+ const helpers = getDirectionHelpers(effectiveDir);
213593
213690
  if (!helpers.isEdgeParagraphInCell(selection.$head, context.cellDepth))
213594
213691
  return null;
213595
213692
  if (!helpers.isAtParagraphBoundary(selection.$head))
@@ -213600,7 +213697,38 @@ function getTableBoundaryExitSelection(state, dir) {
213600
213697
  const targetPos = helpers.findTextPosAcrossBoundary(state, boundaryPos);
213601
213698
  if (targetPos != null)
213602
213699
  return TextSelection.create(state.doc, targetPos);
213603
- return findSelectionNearBoundary(state, boundaryPos, dir);
213700
+ return findSelectionNearBoundary(state, boundaryPos, effectiveDir);
213701
+ }
213702
+ function getIntraTableArrowSelection(state, dir, expandSelection) {
213703
+ const selection = state.selection;
213704
+ if (!selection.empty)
213705
+ return null;
213706
+ const context = getTableContext(selection.$head);
213707
+ if (!context)
213708
+ return null;
213709
+ if (!isRtlTable(context.table))
213710
+ return null;
213711
+ const effectiveDir = getEffectiveTableDir(context.table, dir);
213712
+ const helpers = getDirectionHelpers(effectiveDir);
213713
+ if (!helpers.isEdgeParagraphInCell(selection.$head, context.cellDepth))
213714
+ return null;
213715
+ if (!helpers.isAtParagraphBoundary(selection.$head))
213716
+ return null;
213717
+ const { map: map$12 } = getCellRect(context);
213718
+ const currentCellRelativePos = context.cellStart - context.tableStart;
213719
+ const nextCellRelativePos = map$12.nextCell(currentCellRelativePos, "horiz", effectiveDir);
213720
+ if (nextCellRelativePos == null)
213721
+ return null;
213722
+ const nextCellAbsolutePos = context.tableStart + nextCellRelativePos;
213723
+ if (expandSelection)
213724
+ return CellSelection.create(state.doc, context.cellStart, nextCellAbsolutePos);
213725
+ const nextCellNode = state.doc.nodeAt(nextCellAbsolutePos);
213726
+ if (!nextCellNode)
213727
+ return null;
213728
+ const targetPos = effectiveDir > 0 ? findFirstTextPosInNode(nextCellNode, nextCellAbsolutePos) : findLastTextPosInNode(nextCellNode, nextCellAbsolutePos);
213729
+ if (targetPos != null)
213730
+ return TextSelection.create(state.doc, targetPos);
213731
+ return findSelectionNearBoundary(state, nextCellAbsolutePos, effectiveDir);
213604
213732
  }
213605
213733
  function getAdjacentTableEntrySelection(state, dir) {
213606
213734
  const selection = state.selection;
@@ -213617,13 +213745,14 @@ function getAdjacentTableEntrySelection(state, dir) {
213617
213745
  const adjacentNode = dir > 0 ? $boundary.nodeAfter : $boundary.nodeBefore;
213618
213746
  if (!adjacentNode || adjacentNode.type.spec.tableRole !== "table")
213619
213747
  return null;
213620
- if (dir > 0) {
213621
- const targetPos$1 = findFirstTextPosInNode(adjacentNode, boundaryPos);
213748
+ const effectiveDir = isRtlTable(adjacentNode) ? -dir : dir;
213749
+ const tablePos = dir > 0 ? boundaryPos : boundaryPos - adjacentNode.nodeSize;
213750
+ if (effectiveDir > 0) {
213751
+ const targetPos$1 = findFirstTextPosInNode(adjacentNode, tablePos);
213622
213752
  if (targetPos$1 != null)
213623
213753
  return TextSelection.create(state.doc, targetPos$1);
213624
- return findSelectionNearBoundary(state, boundaryPos, 1);
213754
+ return findSelectionNearBoundary(state, tablePos, 1);
213625
213755
  }
213626
- const tablePos = boundaryPos - adjacentNode.nodeSize;
213627
213756
  const targetPos = findLastTextPosInNode(adjacentNode, tablePos);
213628
213757
  if (targetPos != null)
213629
213758
  return TextSelection.create(state.doc, targetPos);
@@ -213635,7 +213764,7 @@ function createTableBoundaryNavigationPlugin() {
213635
213764
  props: { handleKeyDown(view, event) {
213636
213765
  if (event.defaultPrevented)
213637
213766
  return false;
213638
- if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)
213767
+ if (event.altKey || event.ctrlKey || event.metaKey)
213639
213768
  return false;
213640
213769
  if ((event.key === "Backspace" || event.key === "Delete") && isInProtectedTrailingTableParagraph(view.state)) {
213641
213770
  event.preventDefault();
@@ -213644,7 +213773,14 @@ function createTableBoundaryNavigationPlugin() {
213644
213773
  const dir = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
213645
213774
  if (!dir)
213646
213775
  return false;
213647
- const nextSelection = getTableBoundaryExitSelection(view.state, dir) ?? getAdjacentTableEntrySelection(view.state, dir);
213776
+ const context = getTableContext(view.state.selection.$head);
213777
+ const allowShiftInRtlTable = Boolean(event.shiftKey && context && isRtlTable(context.table));
213778
+ if (event.shiftKey && !allowShiftInRtlTable)
213779
+ return false;
213780
+ let nextSelection = getIntraTableArrowSelection(view.state, dir, event.shiftKey);
213781
+ if (!nextSelection && event.shiftKey)
213782
+ return false;
213783
+ nextSelection = nextSelection ?? getTableBoundaryExitSelection(view.state, dir) ?? getAdjacentTableEntrySelection(view.state, dir);
213648
213784
  if (!nextSelection)
213649
213785
  return false;
213650
213786
  view.dispatch(view.state.tr.setSelection(nextSelection).scrollIntoView());
@@ -255206,18 +255342,28 @@ function resolveRenderedTableWidth(columnWidth, measuredWidth, attrs) {
255206
255342
  }
255207
255343
  function resolveTableFrame(baseX, columnWidth, tableWidth, attrs) {
255208
255344
  const width = resolveRenderedTableWidth(columnWidth, tableWidth, attrs);
255209
- const justification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
255210
- if (justification === "center")
255345
+ const explicitJustification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
255346
+ const isRtlTable$1 = attrs?.tableProperties?.rightToLeft === true;
255347
+ const effectiveJustification = explicitJustification ?? (isRtlTable$1 ? "end" : undefined);
255348
+ const tableIndent = getTableIndentWidth(attrs);
255349
+ if (effectiveJustification === "center")
255211
255350
  return {
255212
255351
  x: baseX + (columnWidth - width) / 2,
255213
255352
  width
255214
255353
  };
255215
- if (justification === "right" || justification === "end")
255354
+ if (effectiveJustification === "right" || effectiveJustification === "end") {
255355
+ const rightAlignedX = baseX + (columnWidth - width);
255356
+ if (explicitJustification == null && isRtlTable$1 && tableIndent !== 0)
255357
+ return {
255358
+ x: rightAlignedX - tableIndent,
255359
+ width
255360
+ };
255216
255361
  return {
255217
- x: baseX + (columnWidth - width),
255362
+ x: rightAlignedX,
255218
255363
  width
255219
255364
  };
255220
- return applyTableIndent(baseX, width, getTableIndentWidth(attrs), columnWidth);
255365
+ }
255366
+ return applyTableIndent(baseX, width, tableIndent, columnWidth);
255221
255367
  }
255222
255368
  function calculateColumnMinWidth(measuredWidth) {
255223
255369
  if (!Number.isFinite(measuredWidth) || measuredWidth <= 0)
@@ -263588,30 +263734,61 @@ function isTableBorderValue(value) {
263588
263734
  function extractTableBorders(bordersInput, options) {
263589
263735
  if (!bordersInput || typeof bordersInput !== "object")
263590
263736
  return;
263591
- const sides = [
263737
+ const borders = {};
263738
+ const assignConverted = (side, raw) => {
263739
+ if (raw == null)
263740
+ return;
263741
+ if (isTableBorderValue(raw)) {
263742
+ borders[side] = raw;
263743
+ return;
263744
+ }
263745
+ const converted = convertTableBorderValue(raw, options);
263746
+ if (converted !== undefined)
263747
+ borders[side] = converted;
263748
+ };
263749
+ for (const side of [
263592
263750
  "top",
263593
263751
  "right",
263594
263752
  "bottom",
263595
263753
  "left",
263596
263754
  "insideH",
263597
263755
  "insideV"
263598
- ];
263756
+ ])
263757
+ assignConverted(side, bordersInput[side]);
263758
+ if (borders.left == null)
263759
+ assignConverted("left", bordersInput.start);
263760
+ if (borders.right == null)
263761
+ assignConverted("right", bordersInput.end);
263762
+ return Object.keys(borders).length > 0 ? borders : undefined;
263763
+ }
263764
+ function extractCellBorders(cellAttrs, _options) {
263765
+ if (!cellAttrs?.borders)
263766
+ return;
263767
+ const bordersData = cellAttrs.borders;
263599
263768
  const borders = {};
263600
- for (const side of sides) {
263601
- const raw = bordersInput[side];
263602
- if (raw == null)
263603
- continue;
263604
- if (isTableBorderValue(raw))
263605
- borders[side] = raw;
263606
- else {
263607
- const converted = convertTableBorderValue(raw, options);
263608
- if (converted !== undefined)
263609
- borders[side] = converted;
263610
- }
263769
+ for (const side of [
263770
+ "top",
263771
+ "right",
263772
+ "bottom",
263773
+ "left"
263774
+ ]) {
263775
+ const spec = convertBorderSpec(bordersData[side]);
263776
+ if (spec)
263777
+ borders[side] = spec;
263778
+ }
263779
+ if (borders.left == null) {
263780
+ const spec = convertBorderSpec(bordersData.start);
263781
+ if (spec)
263782
+ borders.left = spec;
263783
+ }
263784
+ if (borders.right == null) {
263785
+ const spec = convertBorderSpec(bordersData.end);
263786
+ if (spec)
263787
+ borders.right = spec;
263611
263788
  }
263612
263789
  return Object.keys(borders).length > 0 ? borders : undefined;
263613
263790
  }
263614
- function extractCellPadding(cellAttrs) {
263791
+ function extractCellPadding(cellAttrs, _options) {
263615
263792
  const cellMargins = cellAttrs?.cellMargins;
263616
263793
  if (!cellMargins || typeof cellMargins !== "object")
263617
263794
  return;
@@ -263625,6 +263802,12 @@ function extractCellPadding(cellAttrs) {
263625
263802
  padding.bottom = margins.bottom;
263626
263803
  if (typeof margins.left === "number")
263627
263804
  padding.left = margins.left;
263805
+ const marginStart = margins.marginStart;
263806
+ const marginEnd = margins.marginEnd;
263807
+ if (typeof marginStart === "number" && padding.left == null)
263808
+ padding.left = marginStart;
263809
+ if (typeof marginEnd === "number" && padding.right == null)
263810
+ padding.right = marginEnd;
263628
263811
  if (Object.keys(padding).length === 0)
263629
263812
  return;
263630
263813
  return normalizeCellPaddingTopBottom(padding);
@@ -265449,7 +265632,11 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
265449
265632
  };
265450
265633
  };
265451
265634
  const borderSource = getBorderSource();
265452
- const tableBorders = borderSource ? extractTableBorders(borderSource.borders, { unit: borderSource.unit }) : undefined;
265635
+ const isRtlTable$1 = tablePropertiesForCascade?.rightToLeft === true;
265636
+ const tableBorders = borderSource ? extractTableBorders(borderSource.borders, {
265637
+ unit: borderSource.unit,
265638
+ isRtl: isRtlTable$1
265639
+ }) : undefined;
265453
265640
  if (tableBorders)
265454
265641
  tableAttrs.borders = tableBorders;
265455
265642
  if (node3.attrs?.borderCollapse)
@@ -267487,7 +267674,7 @@ function computeCaretLayoutRectGeometry({ layout, blocks: blocks2, measures, pai
267487
267674
  });
267488
267675
  const availableWidth = Math.max(0, fragment2.width - (indentAdjust + indent2.right));
267489
267676
  const charX = measureCharacterX(block, line, pmOffset, availableWidth);
267490
- const resolvedCharX = block.attrs?.direction === "rtl" ? Math.max(0, availableWidth - charX) : charX;
267677
+ const resolvedCharX = getParagraphInlineDirection(block.attrs) === "rtl" ? Math.max(0, availableWidth - charX) : charX;
267491
267678
  const localX = fragment2.x + indentAdjust + resolvedCharX;
267492
267679
  const lineOffset = lineHeightBeforeIndex(measure.lines, fragment2.fromLine, index2);
267493
267680
  const localY = fragment2.y + lineOffset;
@@ -276201,7 +276388,32 @@ var Node$13 = class Node$14 {
276201
276388
  });
276202
276389
  }, unsetLineHeight = () => ({ commands: commands$1 }) => {
276203
276390
  return commands$1.resetAttributes("paragraph", "paragraphProperties.spacing.line", "paragraphProperties.spacing.lineRule");
276204
- }, backspaceEmptyRunParagraph = () => ({ state, dispatch }) => {
276391
+ }, setParagraphDirection = ({ direction, alignmentPolicy } = {}) => {
276392
+ if (direction !== "ltr" && direction !== "rtl")
276393
+ return () => false;
276394
+ return walkParagraphs$1((pPr, { editor, $pos }) => {
276395
+ const next2 = { ...pPr };
276396
+ if (direction === "rtl")
276397
+ next2.rightToLeft = true;
276398
+ else {
276399
+ delete next2.rightToLeft;
276400
+ if (resolveHypotheticalParagraphProperties(editor, $pos, next2)?.rightToLeft === true)
276401
+ next2.rightToLeft = false;
276402
+ }
276403
+ if (alignmentPolicy === "matchDirection") {
276404
+ const j = pPr.justification;
276405
+ if (j === "left" && direction === "rtl")
276406
+ next2.justification = "right";
276407
+ else if (j === "right" && direction === "ltr")
276408
+ next2.justification = "left";
276409
+ }
276410
+ return next2;
276411
+ });
276412
+ }, clearParagraphDirection = () => walkParagraphs$1((pPr) => {
276413
+ const next2 = { ...pPr };
276414
+ delete next2.rightToLeft;
276415
+ return next2;
276416
+ }), backspaceEmptyRunParagraph = () => ({ state, dispatch }) => {
276205
276417
  const { $from } = state.selection;
276206
276418
  if (!state.selection.empty)
276207
276419
  return false;
@@ -290080,6 +290292,7 @@ menclose::after {
290080
290292
  min: boundary.minWidth,
290081
290293
  r: boundary.resizable ? 1 : 0
290082
290294
  })),
290295
+ rtl: isRtl,
290083
290296
  segments: boundarySegments.map((segs, colIndex) => segs.map((seg) => ({
290084
290297
  c: colIndex,
290085
290298
  y: seg.y + contentTop,
@@ -290098,7 +290311,7 @@ menclose::after {
290098
290311
  }
290099
290312
  if (block.id)
290100
290313
  container.setAttribute("data-sd-block-id", block.id);
290101
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && block.attrs?.cellSpacing && tableBorders) {
290314
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
290102
290315
  applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
290103
290316
  applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
290104
290317
  applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
@@ -290254,7 +290467,7 @@ menclose::after {
290254
290467
  y$1 += actualRowHeight + cellSpacingPx;
290255
290468
  }
290256
290469
  return container;
290257
- }, isRtlParagraph = (attrs) => attrs?.direction === "rtl", resolveTextAlign = (alignment$1, isRtl) => {
290470
+ }, isRtlParagraph = (attrs) => getParagraphInlineDirection(attrs) === "rtl", resolveTextAlign = (alignment$1, isRtl) => {
290258
290471
  switch (alignment$1) {
290259
290472
  case "center":
290260
290473
  case "right":
@@ -291578,7 +291791,7 @@ menclose::after {
291578
291791
  attrs.borders ? hashParagraphBorders$1(attrs.borders) : "",
291579
291792
  attrs.shading?.fill ?? "",
291580
291793
  attrs.shading?.color ?? "",
291581
- attrs.direction ?? "",
291794
+ getParagraphInlineDirection(attrs) ?? "",
291582
291795
  attrs.tabs?.length ? JSON.stringify(attrs.tabs) : ""
291583
291796
  ].join(":") : "";
291584
291797
  const sdtAttrs = block.attrs?.sdt;
@@ -291706,7 +291919,7 @@ menclose::after {
291706
291919
  hash$3 = hashNumber(hash$3, attrs.indent?.hanging ?? 0);
291707
291920
  hash$3 = hashString(hash$3, attrs.shading?.fill ?? "");
291708
291921
  hash$3 = hashString(hash$3, attrs.shading?.color ?? "");
291709
- hash$3 = hashString(hash$3, attrs.direction ?? "");
291922
+ hash$3 = hashString(hash$3, getParagraphInlineDirection(attrs) ?? "");
291710
291923
  if (attrs.borders)
291711
291924
  hash$3 = hashString(hash$3, hashParagraphBorders$1(attrs.borders));
291712
291925
  }
@@ -292422,8 +292635,9 @@ menclose::after {
292422
292635
  if (sh.color)
292423
292636
  parts.push(`shc:${sh.color}`);
292424
292637
  }
292425
- if (attrs.direction)
292426
- parts.push(`dir:${attrs.direction}`);
292638
+ const cellDir = getParagraphInlineDirection(attrs);
292639
+ if (cellDir)
292640
+ parts.push(`dir:${cellDir}`);
292427
292641
  if (parts.length > 0)
292428
292642
  cellHashes.push(`pa:${parts.join(":")}`);
292429
292643
  }
@@ -292529,8 +292743,9 @@ menclose::after {
292529
292743
  const tabsHash = attrs.tabs.map((t) => `${t.val ?? ""}:${t.pos ?? ""}:${t.leader ?? ""}`).join(",");
292530
292744
  parts.push(`tb:${tabsHash}`);
292531
292745
  }
292532
- if (attrs.direction)
292533
- parts.push(`dir:${attrs.direction}`);
292746
+ const dir = getParagraphInlineDirection(attrs);
292747
+ if (dir)
292748
+ parts.push(`dir:${dir}`);
292534
292749
  if (attrs.keepNext)
292535
292750
  parts.push("kn");
292536
292751
  if (attrs.keepLines)
@@ -296825,10 +297040,11 @@ menclose::after {
296825
297040
  }, EMPTY_CHART_DATA, hydrateTableStyleAttrs = (tableNode, context, effectiveStyleId) => {
296826
297041
  const hydration = {};
296827
297042
  const tableProps = tableNode.attrs?.tableProperties ?? null;
297043
+ const isRtlTable$1 = tableProps?.rightToLeft === true;
296828
297044
  let inlineBorders;
296829
297045
  let inlinePadding;
296830
297046
  if (tableProps) {
296831
- const padding = convertCellMarginsToPx(tableProps.cellMargins);
297047
+ const padding = convertCellMarginsToPx(tableProps.cellMargins, isRtlTable$1);
296832
297048
  if (padding)
296833
297049
  inlinePadding = normalizeCellPaddingTopBottom(padding);
296834
297050
  if (tableProps.borders && typeof tableProps.borders === "object")
@@ -296859,7 +297075,7 @@ menclose::after {
296859
297075
  } else if (inlineBorders)
296860
297076
  hydration.borders = inlineBorders;
296861
297077
  if (resolved.cellMargins) {
296862
- const stylePadding = convertCellMarginsToPx(resolved.cellMargins);
297078
+ const stylePadding = convertCellMarginsToPx(resolved.cellMargins, isRtlTable$1);
296863
297079
  if (stylePadding) {
296864
297080
  const normalizedStylePadding = normalizeCellPaddingTopBottom(stylePadding);
296865
297081
  hydration.cellPadding = inlinePadding ? {
@@ -296905,7 +297121,9 @@ menclose::after {
296905
297121
  "left",
296906
297122
  "right",
296907
297123
  "insideH",
296908
- "insideV"
297124
+ "insideV",
297125
+ "start",
297126
+ "end"
296909
297127
  ];
296910
297128
  const result = {};
296911
297129
  for (const side of sides) {
@@ -296923,7 +297141,7 @@ menclose::after {
296923
297141
  ...border,
296924
297142
  size: size$1
296925
297143
  } : border;
296926
- }, convertCellMarginsToPx = (margins) => {
297144
+ }, convertCellMarginsToPx = (margins, isRtlTable$1 = false) => {
296927
297145
  if (!margins || typeof margins !== "object")
296928
297146
  return;
296929
297147
  const spacing = {};
@@ -296936,8 +297154,8 @@ menclose::after {
296936
297154
  marginBottom: "bottom",
296937
297155
  marginLeft: "left",
296938
297156
  marginRight: "right",
296939
- marginStart: "left",
296940
- marginEnd: "right"
297157
+ marginStart: isRtlTable$1 ? "right" : "left",
297158
+ marginEnd: isRtlTable$1 ? "left" : "right"
296941
297159
  };
296942
297160
  Object.entries(margins).forEach(([key2, value]) => {
296943
297161
  const side = keyMap[key2];
@@ -297230,6 +297448,7 @@ menclose::after {
297230
297448
  return null;
297231
297449
  const cellAttrs = {};
297232
297450
  if (resolvedTcProps?.borders && typeof resolvedTcProps.borders === "object") {
297451
+ const resolvedBordersData = resolvedTcProps.borders;
297233
297452
  const resolvedBorders = {};
297234
297453
  for (const side of [
297235
297454
  "top",
@@ -297237,36 +297456,46 @@ menclose::after {
297237
297456
  "bottom",
297238
297457
  "left"
297239
297458
  ]) {
297240
- const spec = convertResolvedCellBorder(resolvedTcProps.borders[side]);
297459
+ const spec = convertResolvedCellBorder(resolvedBordersData[side]);
297241
297460
  if (spec)
297242
297461
  resolvedBorders[side] = spec;
297243
297462
  }
297463
+ if (resolvedBorders.left == null) {
297464
+ const spec = convertResolvedCellBorder(resolvedBordersData.start);
297465
+ if (spec)
297466
+ resolvedBorders.left = spec;
297467
+ }
297468
+ if (resolvedBorders.right == null) {
297469
+ const spec = convertResolvedCellBorder(resolvedBordersData.end);
297470
+ if (spec)
297471
+ resolvedBorders.right = spec;
297472
+ }
297244
297473
  if (Object.keys(resolvedBorders).length > 0)
297245
297474
  cellAttrs.borders = resolvedBorders;
297246
297475
  }
297247
297476
  if (!cellAttrs.borders && cellNode.attrs?.borders && typeof cellNode.attrs.borders === "object") {
297248
297477
  const legacy = cellNode.attrs.borders;
297249
- const fallback = {};
297478
+ const filteredLegacyBorders = {};
297250
297479
  for (const side of [
297251
297480
  "top",
297252
297481
  "right",
297253
297482
  "bottom",
297254
- "left"
297483
+ "left",
297484
+ "start",
297485
+ "end"
297255
297486
  ]) {
297256
297487
  const b$1 = legacy[side];
297257
- if (b$1 && b$1.val && typeof b$1.size === "number" && b$1.size > 0) {
297258
- const color2 = b$1.color ? b$1.color.startsWith("#") ? b$1.color : `#${b$1.color}` : "#000000";
297259
- fallback[side] = {
297260
- style: normalizeLegacyBorderStyle(b$1.val),
297261
- width: b$1.size,
297262
- color: color2
297488
+ if (b$1 && b$1.val && typeof b$1.size === "number" && b$1.size > 0)
297489
+ filteredLegacyBorders[side] = {
297490
+ ...b$1,
297491
+ val: normalizeLegacyBorderStyle(b$1.val)
297263
297492
  };
297264
- }
297265
297493
  }
297266
- if (Object.keys(fallback).length > 0)
297494
+ const fallback = extractCellBorders({ borders: filteredLegacyBorders }, { isRtl: tableProperties?.rightToLeft === true });
297495
+ if (fallback)
297267
297496
  cellAttrs.borders = fallback;
297268
297497
  }
297269
- const padding = extractCellPadding(cellNode.attrs ?? {}) ?? (defaultCellPadding ? { ...defaultCellPadding } : undefined);
297498
+ const padding = extractCellPadding(cellNode.attrs ?? {}, { isRtl: tableProperties?.rightToLeft === true }) ?? (defaultCellPadding ? { ...defaultCellPadding } : undefined);
297270
297499
  if (padding)
297271
297500
  cellAttrs.padding = padding;
297272
297501
  const verticalAlign = cellNode.attrs?.verticalAlign;
@@ -302412,12 +302641,12 @@ menclose::after {
302412
302641
  return;
302413
302642
  console.log(...args$1);
302414
302643
  }, 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;
302415
- var init_src_BiYFxw9u_es = __esm(() => {
302644
+ var init_src_OZOxpRA7_es = __esm(() => {
302416
302645
  init_rolldown_runtime_Bg48TavK_es();
302417
- init_SuperConverter_B1Huzhur_es();
302646
+ init_SuperConverter_5Idv4fhC_es();
302418
302647
  init_jszip_C49i9kUs_es();
302419
302648
  init_uuid_qzgm05fK_es();
302420
- init_create_headless_toolbar_B1ifCjiq_es();
302649
+ init_create_headless_toolbar_CEUTigkM_es();
302421
302650
  init_constants_DrU4EASo_es();
302422
302651
  init_dist_B8HfvhaK_es();
302423
302652
  init_unified_Dsuw2be5_es();
@@ -305179,6 +305408,7 @@ ${err.toString()}`);
305179
305408
  backspaceSkipEmptyRun: () => backspaceSkipEmptyRun,
305180
305409
  changeListLevel: () => changeListLevel,
305181
305410
  clearNodes: () => clearNodes,
305411
+ clearParagraphDirection: () => clearParagraphDirection,
305182
305412
  command: () => command,
305183
305413
  createParagraphNear: () => createParagraphNear$1,
305184
305414
  decreaseListIndent: () => decreaseListIndent,
@@ -305225,6 +305455,7 @@ ${err.toString()}`);
305225
305455
  setMark: () => setMark,
305226
305456
  setMeta: () => setMeta,
305227
305457
  setNode: () => setNode,
305458
+ setParagraphDirection: () => setParagraphDirection,
305228
305459
  setSectionHeaderFooterAtSelection: () => setSectionHeaderFooterAtSelection,
305229
305460
  setSectionPageMarginsAtSelection: () => setSectionPageMarginsAtSelection,
305230
305461
  setTextIndentation: () => setTextIndentation,
@@ -321388,6 +321619,10 @@ function print() { __p += __j.call(arguments, '') }
321388
321619
  numberedListLowerAlphaParen: list_lower_alpha_paren_solid_default,
321389
321620
  indentLeft: outdent_solid_default,
321390
321621
  indentRight: indent_solid_default,
321622
+ directionLtr: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z"/></svg>
321623
+ `,
321624
+ directionRtl: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/></svg>
321625
+ `,
321391
321626
  pageBreak: file_half_dashed_solid_default,
321392
321627
  copyFormat: paint_roller_solid_default,
321393
321628
  clearFormatting: text_slash_solid_default,
@@ -322683,6 +322918,8 @@ function print() { __p += __j.call(arguments, '') }
322683
322918
  linkedStyles: "linked-style",
322684
322919
  indentleft: "indent-decrease",
322685
322920
  indentright: "indent-increase",
322921
+ directionLtr: "direction-ltr",
322922
+ directionRtl: "direction-rtl",
322686
322923
  clearFormatting: "clear-formatting",
322687
322924
  copyFormat: "copy-format"
322688
322925
  };
@@ -323673,7 +323910,7 @@ function print() { __p += __j.call(arguments, '') }
323673
323910
  emit("item-clicked");
323674
323911
  emit("command", {
323675
323912
  item,
323676
- argument
323913
+ argument: argument ?? item.argument?.value ?? null
323677
323914
  });
323678
323915
  };
323679
323916
  const handleToolbarButtonTextSubmit = (item, argument) => {
@@ -323964,7 +324201,7 @@ function print() { __p += __j.call(arguments, '') }
323964
324201
  }), 128))], 36);
323965
324202
  };
323966
324203
  }
323967
- }, [["__scopeId", "data-v-7dc120d3"]]);
324204
+ }, [["__scopeId", "data-v-223b4fea"]]);
323968
324205
  Toolbar_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
323969
324206
  __name: "Toolbar",
323970
324207
  emits: [
@@ -324141,6 +324378,8 @@ function print() { __p += __j.call(arguments, '') }
324141
324378
  numberedList: "Numbered list",
324142
324379
  indentLeft: "Left indent",
324143
324380
  indentRight: "Right indent",
324381
+ directionLtr: "Left-to-right",
324382
+ directionRtl: "Right-to-left",
324144
324383
  zoom: "Zoom",
324145
324384
  undo: "Undo",
324146
324385
  redo: "Redo",
@@ -324554,7 +324793,7 @@ function print() { __p += __j.call(arguments, '') }
324554
324793
  this.#deactivateAll();
324555
324794
  return;
324556
324795
  }
324557
- this.toolbarItems.forEach((item) => {
324796
+ [...this.toolbarItems, ...this.overflowItems].forEach((item) => {
324558
324797
  item.resetDisabled();
324559
324798
  this.#applyHeadlessState(item);
324560
324799
  });
@@ -330467,7 +330706,7 @@ function print() { __p += __j.call(arguments, '') }
330467
330706
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
330468
330707
  content3.lines.forEach((resolvedLine) => {
330469
330708
  const paragraphMarkLeftOffset = this.resolveResolvedListParagraphMarkOffset(resolvedLine.isListFirstLine ? resolvedMarker : undefined, fragment2.markerTextWidth, resolvedLine.indentOffset);
330470
- const isRtl = block.attrs?.direction === "rtl";
330709
+ const isRtl = getParagraphInlineDirection(block.attrs) === "rtl";
330471
330710
  const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset, paragraphMarkLeftOffset);
330472
330711
  if (!resolvedLine.isListFirstLine) {
330473
330712
  if (resolvedLine.paddingLeftPx > 0)
@@ -330537,7 +330776,7 @@ function print() { __p += __j.call(arguments, '') }
330537
330776
  const paraIndent = block.attrs?.indent;
330538
330777
  const paraIndentLeft = paraIndent?.left ?? 0;
330539
330778
  const paraIndentRight = paraIndent?.right ?? 0;
330540
- const isRtl = block.attrs?.direction === "rtl";
330779
+ const isRtl = getParagraphInlineDirection(block.attrs) === "rtl";
330541
330780
  const { anchorIndentPx: paraMarkerAnchorIndent, firstLinePx: markerFirstLine, hangingPx: markerHanging } = resolveMarkerIndent(paraIndent, isRtl);
330542
330781
  const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
330543
330782
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
@@ -340448,11 +340687,11 @@ function print() { __p += __j.call(arguments, '') }
340448
340687
  ];
340449
340688
  });
340450
340689
 
340451
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-J9sjN7xC.es.js
340690
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BGYHCZ5O.es.js
340452
340691
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
340453
- var init_create_super_doc_ui_J9sjN7xC_es = __esm(() => {
340454
- init_SuperConverter_B1Huzhur_es();
340455
- init_create_headless_toolbar_B1ifCjiq_es();
340692
+ var init_create_super_doc_ui_BGYHCZ5O_es = __esm(() => {
340693
+ init_SuperConverter_5Idv4fhC_es();
340694
+ init_create_headless_toolbar_CEUTigkM_es();
340456
340695
  MOD_ALIASES = new Set([
340457
340696
  "Mod",
340458
340697
  "Meta",
@@ -340494,16 +340733,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
340494
340733
 
340495
340734
  // ../../packages/superdoc/dist/super-editor.es.js
340496
340735
  var init_super_editor_es = __esm(() => {
340497
- init_src_BiYFxw9u_es();
340498
- init_SuperConverter_B1Huzhur_es();
340736
+ init_src_OZOxpRA7_es();
340737
+ init_SuperConverter_5Idv4fhC_es();
340499
340738
  init_jszip_C49i9kUs_es();
340500
340739
  init_xml_js_CqGKpaft_es();
340501
- init_create_headless_toolbar_B1ifCjiq_es();
340740
+ init_create_headless_toolbar_CEUTigkM_es();
340502
340741
  init_constants_DrU4EASo_es();
340503
340742
  init_dist_B8HfvhaK_es();
340504
340743
  init_unified_Dsuw2be5_es();
340505
340744
  init_DocxZipper_Dh4RtvcE_es();
340506
- init_create_super_doc_ui_J9sjN7xC_es();
340745
+ init_create_super_doc_ui_BGYHCZ5O_es();
340507
340746
  init_ui_CGB3qmy3_es();
340508
340747
  init_eventemitter3_UwU_CLPU_es();
340509
340748
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.100",
3
+ "version": "0.8.0-next.102",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -25,8 +25,8 @@
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",
29
28
  "@superdoc/super-editor": "0.0.1",
29
+ "@superdoc/pm-adapter": "0.0.0",
30
30
  "superdoc": "1.32.0"
31
31
  },
32
32
  "module": "src/index.ts",
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.100",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.100",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.100",
40
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.100",
41
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.100"
37
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.102",
38
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.102",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.102",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.102",
41
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.102"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",