@superdoc-dev/cli 0.8.0-next.105 → 0.8.0-next.108

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 +186 -107
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -66096,7 +66096,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
66096
66096
  emptyOptions2 = {};
66097
66097
  });
66098
66098
 
66099
- // ../../packages/superdoc/dist/chunks/SuperConverter-Odr0JG7X.es.js
66099
+ // ../../packages/superdoc/dist/chunks/SuperConverter-D-cFThyR.es.js
66100
66100
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
66101
66101
  const fieldValue = extension$1.config[field];
66102
66102
  if (typeof fieldValue === "function")
@@ -74932,20 +74932,23 @@ function combineProperties(propertiesArray, options = {}) {
74932
74932
  function isObject(item) {
74933
74933
  return item != null && typeof item === "object" && !Array.isArray(item);
74934
74934
  }
74935
+ function dropConflictingFontSlots(target, source) {
74936
+ const result = { ...target };
74937
+ for (const [concreteKey, themeKey] of FONT_SLOT_THEME_PAIRS)
74938
+ if (source[themeKey] != null) {
74939
+ delete result[concreteKey];
74940
+ delete result[themeKey];
74941
+ } else if (source[concreteKey] != null)
74942
+ delete result[themeKey];
74943
+ return result;
74944
+ }
74935
74945
  function combineRunProperties(propertiesArray) {
74936
74946
  return combineProperties(propertiesArray, {
74937
74947
  fullOverrideProps: ["color"],
74938
74948
  specialHandling: { fontFamily: (target, source) => {
74939
74949
  const fontFamilySource = { ...source.fontFamily };
74940
- const fontFamilyTarget = { ...target.fontFamily };
74941
- if (fontFamilySource.asciiTheme != null) {
74942
- delete fontFamilyTarget.ascii;
74943
- delete fontFamilyTarget.asciiTheme;
74944
- }
74945
- if (fontFamilySource.ascii != null)
74946
- delete fontFamilyTarget.asciiTheme;
74947
74950
  return {
74948
- ...fontFamilyTarget,
74951
+ ...dropConflictingFontSlots(target.fontFamily ?? {}, fontFamilySource),
74949
74952
  ...fontFamilySource
74950
74953
  };
74951
74954
  } }
@@ -84565,6 +84568,27 @@ function resolveHypotheticalParagraphProperties(editor, $pos, inlineProps) {
84565
84568
  translatedLinkedStyles: editor.converter.translatedLinkedStyles
84566
84569
  }, inlineProps, tableStyleId);
84567
84570
  }
84571
+ function mergeFontFamilyPreservingThemeRefs(fromMarks, existing) {
84572
+ const merged = { ...fromMarks || {} };
84573
+ if (!existing || typeof existing !== "object")
84574
+ return merged;
84575
+ for (const [concreteKey, themeKey] of FONT_SLOT_THEME_PAIRS)
84576
+ if (existing[themeKey] != null) {
84577
+ merged[themeKey] = existing[themeKey];
84578
+ delete merged[concreteKey];
84579
+ }
84580
+ return merged;
84581
+ }
84582
+ function marksMatchExistingFontFamily(markFromMarks, existingFontFamily, encode$80, docx) {
84583
+ if (!existingFontFamily || typeof existingFontFamily !== "object")
84584
+ return false;
84585
+ if (!markFromMarks?.attrs)
84586
+ return false;
84587
+ const markFromExisting = encode$80({ fontFamily: existingFontFamily }, docx)?.[0];
84588
+ if (!markFromExisting?.attrs)
84589
+ return false;
84590
+ return markFromMarks.attrs.fontFamily === markFromExisting.attrs.fontFamily;
84591
+ }
84568
84592
  function getRunContext($pos) {
84569
84593
  let paragraphNode = null;
84570
84594
  let paragraphDepth = -1;
@@ -84684,10 +84708,13 @@ function getInlineRunProperties(runPropertiesFromMarks, runPropertiesFromStyles,
84684
84708
  const valueFromStyles = runPropertiesFromStyles[key];
84685
84709
  if (JSON.stringify(valueFromMarks) !== JSON.stringify(valueFromStyles))
84686
84710
  if (key === "fontFamily") {
84687
- const markFromStyles = encodeMarksFromRPr({ [key]: valueFromStyles }, editor.converter?.convertedXml ?? {})[0];
84688
- const markFromMarks = encodeMarksFromRPr({ [key]: valueFromMarks }, editor.converter?.convertedXml ?? {})[0];
84689
- if (JSON.stringify(markFromMarks?.attrs) !== JSON.stringify(markFromStyles?.attrs))
84690
- inlineRunProperties[key] = valueFromMarks;
84711
+ const docx = editor.converter?.convertedXml ?? {};
84712
+ const markFromStyles = encodeMarksFromRPr({ [key]: valueFromStyles }, docx)[0];
84713
+ const markFromMarks = encodeMarksFromRPr({ [key]: valueFromMarks }, docx)[0];
84714
+ if (JSON.stringify(markFromMarks?.attrs) !== JSON.stringify(markFromStyles?.attrs)) {
84715
+ const existingFontFamily = existingRunProperties?.[key];
84716
+ inlineRunProperties[key] = marksMatchExistingFontFamily(markFromMarks, existingFontFamily, encodeMarksFromRPr, docx) ? mergeFontFamilyPreservingThemeRefs(valueFromMarks, existingFontFamily) : valueFromMarks;
84717
+ }
84691
84718
  } else
84692
84719
  inlineRunProperties[key] = valueFromMarks;
84693
84720
  }
@@ -101624,10 +101651,32 @@ function removeSdtPrChild(sdtPr, childName) {
101624
101651
  };
101625
101652
  }
101626
101653
  function applyAttrsUpdate(editor, nodeId, attrsPatch) {
101627
- const updateCmd = editor.commands?.updateStructuredContentById;
101628
- if (typeof updateCmd !== "function")
101654
+ if (!editor?.state)
101629
101655
  return false;
101630
- return Boolean(updateCmd(nodeId, { attrs: attrsPatch }));
101656
+ let foundPos = null;
101657
+ editor.state.doc.descendants((node3, pos) => {
101658
+ if (foundPos !== null)
101659
+ return false;
101660
+ if (SDT_NODE_TYPES.has(node3.type.name) && String(node3.attrs.id) === String(nodeId)) {
101661
+ foundPos = pos;
101662
+ return false;
101663
+ }
101664
+ return true;
101665
+ });
101666
+ if (foundPos === null)
101667
+ return false;
101668
+ const tr = editor.state.tr;
101669
+ for (const [key, value] of Object.entries(attrsPatch))
101670
+ tr.setNodeAttribute(foundPos, key, value);
101671
+ if (tr.steps.length === 0)
101672
+ return true;
101673
+ if (editor.view?.dispatch)
101674
+ editor.view.dispatch(tr);
101675
+ else if (typeof editor.dispatch === "function")
101676
+ editor.dispatch(tr);
101677
+ else
101678
+ return false;
101679
+ return true;
101631
101680
  }
101632
101681
  function updateSdtPrChild(editor, target, childName, updater) {
101633
101682
  const currentSdtPr = resolveSdtByTarget(editor.state.doc, target).node.attrs.sdtPr ?? {
@@ -101861,6 +101910,59 @@ function buildContentControlInfoFromAttrs(attrs, kind) {
101861
101910
  }
101862
101911
  };
101863
101912
  }
101913
+ function assertNotSdtLocked(sdt, operation) {
101914
+ const mode = resolveLockMode(sdt.node.attrs);
101915
+ if (mode === "sdtLocked" || mode === "sdtContentLocked")
101916
+ throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
101917
+ lockMode: mode,
101918
+ operation
101919
+ });
101920
+ }
101921
+ function assertNotContentLocked(sdt, operation) {
101922
+ const mode = resolveLockMode(sdt.node.attrs);
101923
+ if (mode === "contentLocked" || mode === "sdtContentLocked")
101924
+ throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
101925
+ lockMode: mode,
101926
+ operation
101927
+ });
101928
+ }
101929
+ function assertControlType(sdt, expected, operation) {
101930
+ const actual = resolveControlType(sdt.node.attrs);
101931
+ const allowed = Array.isArray(expected) ? expected : [expected];
101932
+ if (!allowed.includes(actual))
101933
+ throw new DocumentApiAdapterError("TYPE_MISMATCH", `Operation "${operation}" requires control type ${allowed.join(" or ")}, but found "${actual}".`, {
101934
+ expected: allowed,
101935
+ actual,
101936
+ operation
101937
+ });
101938
+ }
101939
+ function buildMutationSuccess(target, updatedRef) {
101940
+ const result = {
101941
+ success: true,
101942
+ contentControl: target
101943
+ };
101944
+ if (updatedRef)
101945
+ result.updatedRef = updatedRef;
101946
+ return result;
101947
+ }
101948
+ function buildMutationFailure(code$1, message) {
101949
+ return {
101950
+ success: false,
101951
+ failure: {
101952
+ code: code$1,
101953
+ message
101954
+ }
101955
+ };
101956
+ }
101957
+ function applyPagination(items, opts) {
101958
+ const total = items.length;
101959
+ const offset = opts?.offset ?? 0;
101960
+ const limit = opts?.limit ?? total;
101961
+ return {
101962
+ items: items.slice(offset, offset + limit),
101963
+ total
101964
+ };
101965
+ }
101864
101966
  function resolveBlock(editor, nodeId) {
101865
101967
  const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
101866
101968
  if (matches$1.length === 0)
@@ -105111,7 +105213,7 @@ var isRegExp = (value) => {
105111
105213
  return true;
105112
105214
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
105113
105215
  return objectIncludes(attrsA, attrsB);
105114
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
105216
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, BASELINE_SHIFT_EPSILON = 0.000001, FONT_SLOT_THEME_PAIRS, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
105115
105217
  return SuperConverter.toCssFontFamily;
105116
105218
  }, getSpacingStyle = (spacing, isListItem$1) => {
105117
105219
  let { before: before2, after: after2, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
@@ -119563,7 +119665,7 @@ var isRegExp = (value) => {
119563
119665
  if (id2)
119564
119666
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id2);
119565
119667
  return trackedChanges;
119566
- }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.32.0", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
119668
+ }, DERIVED_ID_LENGTH = 24, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.32.0", collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
119567
119669
  if (!runProps?.elements?.length || !state)
119568
119670
  return;
119569
119671
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -119597,7 +119699,7 @@ var isRegExp = (value) => {
119597
119699
  state.kern = kernNode.attributes["w:val"];
119598
119700
  }
119599
119701
  }, SuperConverter;
119600
- var init_SuperConverter_Odr0JG7X_es = __esm(() => {
119702
+ var init_SuperConverter_D_cFThyR_es = __esm(() => {
119601
119703
  init_rolldown_runtime_Bg48TavK_es();
119602
119704
  init_jszip_C49i9kUs_es();
119603
119705
  init_xml_js_CqGKpaft_es();
@@ -135263,6 +135365,12 @@ var init_SuperConverter_Odr0JG7X_es = __esm(() => {
135263
135365
  "highlight",
135264
135366
  "link"
135265
135367
  ];
135368
+ FONT_SLOT_THEME_PAIRS = [
135369
+ ["ascii", "asciiTheme"],
135370
+ ["hAnsi", "hAnsiTheme"],
135371
+ ["eastAsia", "eastAsiaTheme"],
135372
+ ["cs", "cstheme"]
135373
+ ];
135266
135374
  TABLE_FALLBACK_BORDER = {
135267
135375
  val: "single",
135268
135376
  size: 4,
@@ -155001,12 +155109,7 @@ var init_SuperConverter_Odr0JG7X_es = __esm(() => {
155001
155109
  attributes: validXmlAttributes$3
155002
155110
  };
155003
155111
  translator$8 = NodeTranslator.from(config$24);
155004
- translator$49 = NodeTranslator.from({
155005
- xmlName: "w:bidiVisual",
155006
- sdNodeOrKeyName: "rightToLeft",
155007
- encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
155008
- decode: ({ node: node3 }) => node3.attrs.rightToLeft ? { attributes: {} } : undefined
155009
- });
155112
+ translator$49 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bidiVisual", "rightToLeft"));
155010
155113
  translator$155 = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
155011
155114
  translator$158 = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
155012
155115
  translator$161 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
@@ -156327,6 +156430,7 @@ var init_SuperConverter_Odr0JG7X_es = __esm(() => {
156327
156430
  };
156328
156431
  groupedCache = /* @__PURE__ */ new WeakMap;
156329
156432
  SDT_NODE_NAMES = ["structuredContent", "structuredContentBlock"];
156433
+ SDT_NODE_TYPES = new Set(SDT_NODE_NAMES);
156330
156434
  VALID_CONTROL_TYPES = [
156331
156435
  "text",
156332
156436
  "richText",
@@ -157469,7 +157573,7 @@ var init_SuperConverter_Odr0JG7X_es = __esm(() => {
157469
157573
  };
157470
157574
  });
157471
157575
 
157472
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DR4hZl1N.es.js
157576
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DkFBZ1T1.es.js
157473
157577
  function parseSizeUnit(val = "0") {
157474
157578
  const length3 = val.toString() || "0";
157475
157579
  const value = Number.parseFloat(length3);
@@ -160191,8 +160295,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
160191
160295
  }
160192
160296
  };
160193
160297
  };
160194
- var init_create_headless_toolbar_DR4hZl1N_es = __esm(() => {
160195
- init_SuperConverter_Odr0JG7X_es();
160298
+ var init_create_headless_toolbar_DkFBZ1T1_es = __esm(() => {
160299
+ init_SuperConverter_D_cFThyR_es();
160196
160300
  init_constants_DrU4EASo_es();
160197
160301
  init_dist_B8HfvhaK_es();
160198
160302
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -208890,7 +208994,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
208890
208994
  init_remark_gfm_BhnWr3yf_es();
208891
208995
  });
208892
208996
 
208893
- // ../../packages/superdoc/dist/chunks/src-ByXcviOY.es.js
208997
+ // ../../packages/superdoc/dist/chunks/src-CHVby7ed.es.js
208894
208998
  function deleteProps(obj, propOrProps) {
208895
208999
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
208896
209000
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -209145,6 +209249,16 @@ function getParagraphInlineDirection(attrs) {
209145
209249
  if (attrs?.direction === "ltr" || attrs?.dir === "ltr" || attrs?.rtl === false || ppRtl === false)
209146
209250
  return "ltr";
209147
209251
  }
209252
+ function getTableVisualDirection(attrs) {
209253
+ const fromContext = attrs?.tableDirectionContext?.visualDirection;
209254
+ if (fromContext != null)
209255
+ return fromContext;
209256
+ const tp = attrs?.tableProperties;
209257
+ if (tp?.rightToLeft === true || tp?.bidiVisual === true)
209258
+ return "rtl";
209259
+ if (tp?.rightToLeft === false || tp?.bidiVisual === false)
209260
+ return "ltr";
209261
+ }
209148
209262
  function resolveTableWidthAttr(value) {
209149
209263
  if (!value || typeof value !== "object")
209150
209264
  return null;
@@ -209668,59 +209782,6 @@ function getSuperdocVersion() {
209668
209782
  return "unknown";
209669
209783
  }
209670
209784
  }
209671
- function assertNotSdtLocked(sdt, operation) {
209672
- const mode = resolveLockMode(sdt.node.attrs);
209673
- if (mode === "sdtLocked" || mode === "sdtContentLocked")
209674
- throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
209675
- lockMode: mode,
209676
- operation
209677
- });
209678
- }
209679
- function assertNotContentLocked(sdt, operation) {
209680
- const mode = resolveLockMode(sdt.node.attrs);
209681
- if (mode === "contentLocked" || mode === "sdtContentLocked")
209682
- throw new DocumentApiAdapterError("LOCK_VIOLATION", `Content control "${sdt.node.attrs.id}" has lock mode "${mode}" which prevents ${operation}.`, {
209683
- lockMode: mode,
209684
- operation
209685
- });
209686
- }
209687
- function assertControlType(sdt, expected, operation) {
209688
- const actual = resolveControlType(sdt.node.attrs);
209689
- const allowed = Array.isArray(expected) ? expected : [expected];
209690
- if (!allowed.includes(actual))
209691
- throw new DocumentApiAdapterError("TYPE_MISMATCH", `Operation "${operation}" requires control type ${allowed.join(" or ")}, but found "${actual}".`, {
209692
- expected: allowed,
209693
- actual,
209694
- operation
209695
- });
209696
- }
209697
- function buildMutationSuccess(target, updatedRef) {
209698
- const result = {
209699
- success: true,
209700
- contentControl: target
209701
- };
209702
- if (updatedRef)
209703
- result.updatedRef = updatedRef;
209704
- return result;
209705
- }
209706
- function buildMutationFailure(code7, message) {
209707
- return {
209708
- success: false,
209709
- failure: {
209710
- code: code7,
209711
- message
209712
- }
209713
- };
209714
- }
209715
- function applyPagination(items, opts) {
209716
- const total = items.length;
209717
- const offset$1 = opts?.offset ?? 0;
209718
- const limit = opts?.limit ?? total;
209719
- return {
209720
- items: items.slice(offset$1, offset$1 + limit),
209721
- total
209722
- };
209723
- }
209724
209785
  function getFocusMeta(tr) {
209725
209786
  return tr.getMeta(CustomSelectionPluginKey);
209726
209787
  }
@@ -213644,7 +213705,7 @@ function getTableContext($head) {
213644
213705
  };
213645
213706
  }
213646
213707
  function isRtlTable(table2) {
213647
- return table2?.attrs?.tableProperties?.rightToLeft === true;
213708
+ return getTableVisualDirection(table2?.attrs) === "rtl";
213648
213709
  }
213649
213710
  function getCellRect(context) {
213650
213711
  const map$12 = TableMap.get(context.table);
@@ -244403,22 +244464,24 @@ function alreadyMatchesPlainTextReplacement(sdt, expectedText) {
244403
244464
  }
244404
244465
  function replaceSdtTextContent(editor, target, text5) {
244405
244466
  const resolved = resolveSdtByTarget(editor.state.doc, target);
244467
+ const { tr } = editor.state;
244468
+ const innerFrom = resolved.pos + 1;
244469
+ const innerTo = resolved.pos + resolved.node.nodeSize - 1;
244406
244470
  if (resolved.kind === "inline") {
244407
- const updateCmd = editor.commands?.updateStructuredContentById;
244408
- if (text5.length > 0)
244409
- return Boolean(updateCmd?.(target.nodeId, { text: text5 }));
244410
- const updatedNode$1 = resolved.node.type.create({ ...resolved.node.attrs }, null, resolved.node.marks);
244411
- const { tr: tr$1 } = editor.state;
244412
- tr$1.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode$1);
244413
- dispatchTransaction(editor, tr$1);
244471
+ if (text5.length > 0) {
244472
+ const textNode = editor.schema.text(text5);
244473
+ tr.replaceWith(innerFrom, innerTo, textNode);
244474
+ } else
244475
+ tr.delete(innerFrom, innerTo);
244476
+ dispatchTransaction(editor, tr);
244414
244477
  return true;
244415
244478
  }
244416
244479
  const paragraph2 = buildEmptyBlockContent(editor, resolved.node);
244480
+ if (!paragraph2)
244481
+ return false;
244417
244482
  const paragraphText = text5.length > 0 ? buildTextWithTabs(editor.schema, text5, undefined) : null;
244418
- const updatedParagraph = paragraph2?.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks) ?? null;
244419
- const updatedNode = resolved.node.type.create({ ...resolved.node.attrs }, updatedParagraph, resolved.node.marks);
244420
- const { tr } = editor.state;
244421
- tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode);
244483
+ const updatedParagraph = paragraph2.type.create(paragraph2.attrs ?? null, paragraphText, paragraph2.marks);
244484
+ tr.replaceWith(innerFrom, innerTo, updatedParagraph);
244422
244485
  dispatchTransaction(editor, tr);
244423
244486
  return true;
244424
244487
  }
@@ -255414,7 +255477,7 @@ function resolveRenderedTableWidth(columnWidth, measuredWidth, attrs) {
255414
255477
  function resolveTableFrame(baseX, columnWidth, tableWidth, attrs) {
255415
255478
  const width = resolveRenderedTableWidth(columnWidth, tableWidth, attrs);
255416
255479
  const explicitJustification = typeof attrs?.justification === "string" ? attrs.justification : undefined;
255417
- const isRtlTable$1 = attrs?.tableProperties?.rightToLeft === true;
255480
+ const isRtlTable$1 = getTableVisualDirection(attrs) === "rtl";
255418
255481
  const effectiveJustification = explicitJustification ?? (isRtlTable$1 ? "end" : undefined);
255419
255482
  const tableIndent = getTableIndentWidth(attrs);
255420
255483
  if (effectiveJustification === "center")
@@ -265737,6 +265800,12 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
265737
265800
  const tableProperties = node3.attrs?.tableProperties;
265738
265801
  if (tableProperties && typeof tableProperties === "object")
265739
265802
  tableAttrs.tableProperties = tableProperties;
265803
+ const styleResolvedTableProps = effectiveStyleId && converterContext?.translatedLinkedStyles ? resolveTableProperties(effectiveStyleId, converterContext.translatedLinkedStyles) : undefined;
265804
+ const inlineProps = rawTableProperties;
265805
+ const styleProps = styleResolvedTableProps;
265806
+ const inlineVisual = inlineProps?.rightToLeft ?? inlineProps?.bidiVisual;
265807
+ const styleVisual = styleProps?.rightToLeft ?? styleProps?.bidiVisual;
265808
+ tableAttrs.tableDirectionContext = resolveTableDirection({ rightToLeft: inlineVisual ?? styleVisual }, converterContext?.sectionDirectionContext ?? resolveSectionDirection(undefined));
265740
265809
  let columnWidths = undefined;
265741
265810
  const twipsToPixels$2 = (twips) => {
265742
265811
  return twips / 1440 * 96;
@@ -290306,7 +290375,7 @@ menclose::after {
290306
290375
  const tableBorders = block.attrs?.borders;
290307
290376
  const tableIndentValue = block.attrs?.tableIndent?.width;
290308
290377
  const tableIndent = typeof tableIndentValue === "number" && Number.isFinite(tableIndentValue) ? tableIndentValue : 0;
290309
- const isRtl = block.attrs?.tableProperties?.rightToLeft === true;
290378
+ const isRtl = getTableVisualDirection(block.attrs) === "rtl";
290310
290379
  const container = doc$12.createElement("div");
290311
290380
  container.classList.add(CLASS_NAMES$1.fragment);
290312
290381
  applyStyles$2(container, fragmentStyles);
@@ -295824,6 +295893,16 @@ menclose::after {
295824
295893
  mutated = true;
295825
295894
  }
295826
295895
  return mutated ? mirrored : indent2;
295896
+ }, resolveTableDirection = (tableProperties, parentSection) => {
295897
+ let visualDirection;
295898
+ if (tableProperties?.rightToLeft === true || tableProperties?.bidiVisual === true)
295899
+ visualDirection = "rtl";
295900
+ else if (tableProperties?.rightToLeft === false || tableProperties?.bidiVisual === false)
295901
+ visualDirection = "ltr";
295902
+ return {
295903
+ visualDirection,
295904
+ parentSection
295905
+ };
295827
295906
  }, writingModeFromTextDirection = (val) => {
295828
295907
  switch (val) {
295829
295908
  case "lrTb":
@@ -302738,12 +302817,12 @@ menclose::after {
302738
302817
  return;
302739
302818
  console.log(...args$1);
302740
302819
  }, 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;
302741
- var init_src_ByXcviOY_es = __esm(() => {
302820
+ var init_src_CHVby7ed_es = __esm(() => {
302742
302821
  init_rolldown_runtime_Bg48TavK_es();
302743
- init_SuperConverter_Odr0JG7X_es();
302822
+ init_SuperConverter_D_cFThyR_es();
302744
302823
  init_jszip_C49i9kUs_es();
302745
302824
  init_uuid_qzgm05fK_es();
302746
- init_create_headless_toolbar_DR4hZl1N_es();
302825
+ init_create_headless_toolbar_DkFBZ1T1_es();
302747
302826
  init_constants_DrU4EASo_es();
302748
302827
  init_dist_B8HfvhaK_es();
302749
302828
  init_unified_Dsuw2be5_es();
@@ -340786,11 +340865,11 @@ function print() { __p += __j.call(arguments, '') }
340786
340865
  ];
340787
340866
  });
340788
340867
 
340789
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-C-W-_8d_.es.js
340868
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-0ZhHPCRD.es.js
340790
340869
  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;
340791
- var init_create_super_doc_ui_C_W__8d__es = __esm(() => {
340792
- init_SuperConverter_Odr0JG7X_es();
340793
- init_create_headless_toolbar_DR4hZl1N_es();
340870
+ var init_create_super_doc_ui_0ZhHPCRD_es = __esm(() => {
340871
+ init_SuperConverter_D_cFThyR_es();
340872
+ init_create_headless_toolbar_DkFBZ1T1_es();
340794
340873
  MOD_ALIASES = new Set([
340795
340874
  "Mod",
340796
340875
  "Meta",
@@ -340832,16 +340911,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
340832
340911
 
340833
340912
  // ../../packages/superdoc/dist/super-editor.es.js
340834
340913
  var init_super_editor_es = __esm(() => {
340835
- init_src_ByXcviOY_es();
340836
- init_SuperConverter_Odr0JG7X_es();
340914
+ init_src_CHVby7ed_es();
340915
+ init_SuperConverter_D_cFThyR_es();
340837
340916
  init_jszip_C49i9kUs_es();
340838
340917
  init_xml_js_CqGKpaft_es();
340839
- init_create_headless_toolbar_DR4hZl1N_es();
340918
+ init_create_headless_toolbar_DkFBZ1T1_es();
340840
340919
  init_constants_DrU4EASo_es();
340841
340920
  init_dist_B8HfvhaK_es();
340842
340921
  init_unified_Dsuw2be5_es();
340843
340922
  init_DocxZipper_TPSo9G36_es();
340844
- init_create_super_doc_ui_C_W__8d__es();
340923
+ init_create_super_doc_ui_0ZhHPCRD_es();
340845
340924
  init_ui_CGB3qmy3_es();
340846
340925
  init_eventemitter3_UwU_CLPU_es();
340847
340926
  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.105",
3
+ "version": "0.8.0-next.108",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,9 +24,9 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/document-api": "0.0.1",
28
27
  "@superdoc/super-editor": "0.0.1",
29
28
  "superdoc": "1.32.0",
29
+ "@superdoc/document-api": "0.0.1",
30
30
  "@superdoc/pm-adapter": "0.0.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-x64": "0.8.0-next.105",
38
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.105",
39
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.105",
40
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.105",
41
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.105"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.108",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.108",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.108",
40
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.108",
41
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.108"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",