@superdoc-dev/cli 0.5.0-next.76 → 0.5.0-next.78

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 +102 -50
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -65886,7 +65886,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65886
65886
  emptyOptions2 = {};
65887
65887
  });
65888
65888
 
65889
- // ../../packages/superdoc/dist/chunks/SuperConverter-DKPcCGTm.es.js
65889
+ // ../../packages/superdoc/dist/chunks/SuperConverter-C87tnocN.es.js
65890
65890
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65891
65891
  const fieldValue = extension$1.config[field];
65892
65892
  if (typeof fieldValue === "function")
@@ -74840,11 +74840,19 @@ function encodeMarksFromRPr(runProperties, docx) {
74840
74840
  case "fontFamily":
74841
74841
  const fontFamily = resolveDocxFontFamily(value, docx, getToCssFontFamily());
74842
74842
  textStyleAttrs[key] = fontFamily;
74843
- const eastAsiaFamily = typeof value === "object" && value !== null ? value["eastAsia"] : undefined;
74844
- if (eastAsiaFamily) {
74845
- const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
74846
- if (!fontFamily || eastAsiaCss !== textStyleAttrs.fontFamily)
74847
- textStyleAttrs.eastAsiaFontFamily = eastAsiaCss;
74843
+ if (typeof value === "object" && value !== null) {
74844
+ const eastAsiaFamily = value["eastAsia"];
74845
+ if (eastAsiaFamily) {
74846
+ const eastAsiaCss = getFontFamilyValue$1({ "w:ascii": eastAsiaFamily }, docx);
74847
+ if (!fontFamily || eastAsiaCss !== textStyleAttrs.fontFamily)
74848
+ textStyleAttrs.eastAsiaFontFamily = eastAsiaCss;
74849
+ }
74850
+ const csFamily = value["cs"];
74851
+ if (csFamily) {
74852
+ const csCss = getFontFamilyValue$1({ "w:ascii": csFamily }, docx);
74853
+ if (!fontFamily || csCss !== textStyleAttrs.fontFamily)
74854
+ textStyleAttrs.csFontFamily = csCss;
74855
+ }
74848
74856
  }
74849
74857
  break;
74850
74858
  case "highlight":
@@ -75239,6 +75247,14 @@ function decodeRPrFromMarks(marks) {
75239
75247
  runProperties.fontFamily = result;
75240
75248
  }
75241
75249
  break;
75250
+ case "eastAsiaFontFamily":
75251
+ if (value != null && runProperties.fontFamily)
75252
+ runProperties.fontFamily.eastAsia = value.split(",")[0].trim();
75253
+ break;
75254
+ case "csFontFamily":
75255
+ if (value != null && runProperties.fontFamily)
75256
+ runProperties.fontFamily.cs = value.split(",")[0].trim();
75257
+ break;
75242
75258
  case "vertAlign":
75243
75259
  if (value != null)
75244
75260
  runProperties.vertAlign = value;
@@ -103534,10 +103550,11 @@ var isRegExp = (value) => {
103534
103550
  if (!text$2)
103535
103551
  return textStyleAttrs;
103536
103552
  const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
103537
- if (!eastAsiaFont)
103553
+ if (!(eastAsiaFont || textStyleAttrs?.csFontFamily))
103538
103554
  return textStyleAttrs;
103539
103555
  const normalized = { ...textStyleAttrs };
103540
103556
  delete normalized.eastAsiaFontFamily;
103557
+ delete normalized.csFontFamily;
103541
103558
  if (!(typeof text$2 === "string" && containsEastAsianCharacters(text$2)))
103542
103559
  return normalized;
103543
103560
  return {
@@ -111518,36 +111535,58 @@ var isRegExp = (value) => {
111518
111535
  if (!paragraphNode || paragraphPos === undefined)
111519
111536
  return;
111520
111537
  const { segments, firstInlineProps } = segmentRunByInlineProps(runNode, paragraphNode, tableInfo, $pos, editor, preservedDerivedKeys, preferExistingKeys);
111521
- const runProperties = firstInlineProps ?? null;
111538
+ let runProperties = firstInlineProps ?? null;
111522
111539
  const existingInlineKeys = runNode.attrs?.runPropertiesInlineKeys || [];
111540
+ const hadInlineKeysMetadata = Array.isArray(runNode.attrs?.runPropertiesInlineKeys);
111523
111541
  const styleKeys = runNode.attrs?.runPropertiesStyleKeys || [];
111524
111542
  const keysFromMarks = (segment) => {
111525
111543
  const textNode = segment.content?.find((n) => n.isText);
111526
111544
  return Object.keys(decodeRPrFromMarks(textNode?.marks || []));
111527
111545
  };
111528
111546
  const overrideKeysFromInlineProps = (inlineProps) => styleKeys.filter((k) => inlineProps && (k in inlineProps));
111547
+ const existingRunPropsKeys = new Set(runNode.attrs?.runProperties ? Object.keys(runNode.attrs.runProperties) : []);
111548
+ const computeSegmentKeys = (segmentInlineProps, segment) => {
111549
+ const hasNewInlineProps = segmentInlineProps != null && Object.keys(segmentInlineProps).some((k) => !existingRunPropsKeys.has(k));
111550
+ const markKeysToAdd = !hadInlineKeysMetadata || existingInlineKeys.length > 0 || hasNewInlineProps ? keysFromMarks(segment) : [];
111551
+ const keys$1 = [...new Set([...existingInlineKeys, ...markKeysToAdd])];
111552
+ const ok3 = overrideKeysFromInlineProps(segmentInlineProps);
111553
+ return {
111554
+ inlineKeys: keys$1.length ? keys$1 : hadInlineKeysMetadata ? [] : null,
111555
+ overrideKeys: ok3?.length ? ok3 : null
111556
+ };
111557
+ };
111529
111558
  if (segments.length === 1) {
111530
111559
  const hadInlineKeys = Array.isArray(runNode.attrs?.runPropertiesInlineKeys) && runNode.attrs.runPropertiesInlineKeys.length > 0;
111531
111560
  if (JSON.stringify(runProperties) === JSON.stringify(runNode.attrs.runProperties) && hadInlineKeys)
111532
111561
  return;
111533
- const newInlineKeys = [...new Set([...existingInlineKeys, ...keysFromMarks(segments[0])])];
111534
- const newOverrideKeys = overrideKeysFromInlineProps(runProperties);
111562
+ if (hadInlineKeys) {
111563
+ const computedKeys = new Set(runProperties ? Object.keys(runProperties) : []);
111564
+ const lostKeys = existingInlineKeys.filter((k) => !computedKeys.has(k));
111565
+ if (lostKeys.length > 0) {
111566
+ if (!runProperties)
111567
+ runProperties = {};
111568
+ lostKeys.forEach((k) => {
111569
+ if (runNode.attrs?.runProperties?.[k] !== undefined)
111570
+ runProperties[k] = runNode.attrs.runProperties[k];
111571
+ });
111572
+ }
111573
+ }
111574
+ const { inlineKeys: newInlineKeys, overrideKeys: newOverrideKeys } = computeSegmentKeys(runProperties, segments[0]);
111535
111575
  tr.setNodeMarkup(mappedPos, runNode.type, {
111536
111576
  ...runNode.attrs,
111537
111577
  runProperties,
111538
- runPropertiesInlineKeys: newInlineKeys.length ? newInlineKeys : null,
111539
- runPropertiesOverrideKeys: newOverrideKeys.length ? newOverrideKeys : null
111578
+ runPropertiesInlineKeys: newInlineKeys,
111579
+ runPropertiesOverrideKeys: newOverrideKeys
111540
111580
  }, runNode.marks);
111541
111581
  } else {
111542
111582
  const newRuns = segments.map((segment) => {
111543
111583
  const props = segment.inlineProps ?? null;
111544
- const segmentInlineKeys = [...new Set([...existingInlineKeys, ...keysFromMarks(segment)])];
111545
- const segmentOverrideKeys = overrideKeysFromInlineProps(props);
111584
+ const { inlineKeys: segInlineKeys, overrideKeys: segOverrideKeys } = computeSegmentKeys(props, segment);
111546
111585
  return runType.create({
111547
111586
  ...runNode.attrs ?? {},
111548
111587
  runProperties: props,
111549
- runPropertiesInlineKeys: segmentInlineKeys.length ? segmentInlineKeys : null,
111550
- runPropertiesOverrideKeys: segmentOverrideKeys.length ? segmentOverrideKeys : null
111588
+ runPropertiesInlineKeys: segInlineKeys,
111589
+ runPropertiesOverrideKeys: segOverrideKeys
111551
111590
  }, Fragment.fromArray(segment.content), runNode.marks);
111552
111591
  });
111553
111592
  const replacement = Fragment.fromArray(newRuns);
@@ -114722,16 +114761,20 @@ var isRegExp = (value) => {
114722
114761
  }, config$13, translator$21, XML_NODE_NAME$12 = "sd:tableOfContents", SD_NODE_NAME$10 = "tableOfContents", encode$16 = (params3) => {
114723
114762
  const { nodes = [], nodeListHandler } = params3 || {};
114724
114763
  const node3 = nodes[0];
114725
- const processedContent = nodeListHandler.handler({
114764
+ let processedContent = nodeListHandler.handler({
114726
114765
  ...params3,
114727
114766
  nodes: node3.elements || []
114728
114767
  });
114768
+ if (!(processedContent || []).some((child) => child?.type === "paragraph"))
114769
+ processedContent = [{
114770
+ type: "paragraph",
114771
+ content: processedContent.filter((child) => Boolean(child && child.type))
114772
+ }];
114773
+ const attrs = { instruction: node3.attributes?.instruction || "" };
114774
+ attrs.rightAlignPageNumbers = deriveRightAlignPageNumbers(processedContent);
114729
114775
  return {
114730
114776
  type: "tableOfContents",
114731
- attrs: {
114732
- instruction: node3.attributes?.instruction || "",
114733
- rightAlignPageNumbers: deriveRightAlignPageNumbers(processedContent)
114734
- },
114777
+ attrs,
114735
114778
  content: processedContent
114736
114779
  };
114737
114780
  }, decode$16 = (params3) => {
@@ -117503,7 +117546,7 @@ var isRegExp = (value) => {
117503
117546
  state.kern = kernNode.attributes["w:val"];
117504
117547
  }
117505
117548
  }, SuperConverter;
117506
- var init_SuperConverter_DKPcCGTm_es = __esm(() => {
117549
+ var init_SuperConverter_C87tnocN_es = __esm(() => {
117507
117550
  init_rolldown_runtime_Bg48TavK_es();
117508
117551
  init_jszip_C49i9kUs_es();
117509
117552
  init_xml_js_CqGKpaft_es();
@@ -154595,7 +154638,7 @@ var init_SuperConverter_DKPcCGTm_es = __esm(() => {
154595
154638
  };
154596
154639
  });
154597
154640
 
154598
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BTSQjUTS.es.js
154641
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-sUHsO53v.es.js
154599
154642
  function parseSizeUnit(val = "0") {
154600
154643
  const length3 = val.toString() || "0";
154601
154644
  const value = Number.parseFloat(length3);
@@ -156206,8 +156249,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
156206
156249
  return false;
156207
156250
  return Boolean(checker(attrs));
156208
156251
  };
156209
- var init_create_headless_toolbar_BTSQjUTS_es = __esm(() => {
156210
- init_SuperConverter_DKPcCGTm_es();
156252
+ var init_create_headless_toolbar_sUHsO53v_es = __esm(() => {
156253
+ init_SuperConverter_C87tnocN_es();
156211
156254
  init_constants_CGhJRd87_es();
156212
156255
  init_dist_B8HfvhaK_es();
156213
156256
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -204645,7 +204688,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204645
204688
  init_remark_gfm_BhnWr3yf_es();
204646
204689
  });
204647
204690
 
204648
- // ../../packages/superdoc/dist/chunks/src-osCd4WFE.es.js
204691
+ // ../../packages/superdoc/dist/chunks/src-yBJbeHWu.es.js
204649
204692
  function deleteProps(obj, propOrProps) {
204650
204693
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204651
204694
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -222912,11 +222955,15 @@ function resolveStructuralRangeRewrite(doc$12, absFrom, absTo, step3) {
222912
222955
  });
222913
222956
  return null;
222914
222957
  }
222915
- const replacementBlocks = payload.blocks;
222958
+ const effectiveBlocks = [...payload.blocks];
222959
+ if (payload.splitBefore)
222960
+ effectiveBlocks.unshift("");
222961
+ if (payload.splitAfter)
222962
+ effectiveBlocks.push("");
222916
222963
  if (replacesEntireTextblock) {
222917
- if (replacementBlocks.length <= 1) {
222964
+ if (effectiveBlocks.length <= 1) {
222918
222965
  debugTextRewrite("structural rewrite skipped: whole-textblock rewrite resolved to one block", {
222919
- replacementBlocks,
222966
+ replacementBlocks: effectiveBlocks,
222920
222967
  stepId: step3.id
222921
222968
  });
222922
222969
  return null;
@@ -222931,13 +222978,13 @@ function resolveStructuralRangeRewrite(doc$12, absFrom, absTo, step3) {
222931
222978
  inlineRange,
222932
222979
  replaceFrom,
222933
222980
  replaceTo,
222934
- replacementBlockCount: replacementBlocks.length,
222981
+ replacementBlockCount: effectiveBlocks.length,
222935
222982
  openStart: 0,
222936
222983
  openEnd: 0,
222937
222984
  stepId: step3.id
222938
222985
  });
222939
222986
  return {
222940
- replacementBlocks,
222987
+ replacementBlocks: effectiveBlocks,
222941
222988
  paragraphAttrs: stripIdentityAttrs($from.node(textblockDepth).attrs),
222942
222989
  replaceFrom,
222943
222990
  replaceTo,
@@ -222949,11 +222996,6 @@ function resolveStructuralRangeRewrite(doc$12, absFrom, absTo, step3) {
222949
222996
  }
222950
222997
  const leadingWrappers = resolveInlineWrapperChainAt(doc$12, absFrom, textblockDepth);
222951
222998
  const trailingWrappers = resolveInlineWrapperChainAt(doc$12, absTo, textblockDepth);
222952
- const effectiveBlocks = [...replacementBlocks];
222953
- if (payload.splitBefore)
222954
- effectiveBlocks.unshift("");
222955
- if (payload.splitAfter)
222956
- effectiveBlocks.push("");
222957
222999
  const openStart = 1 + leadingWrappers.length;
222958
223000
  const openEnd = 1 + trailingWrappers.length;
222959
223001
  debugTextRewrite("structural rewrite enabled", {
@@ -287704,12 +287746,12 @@ var Node$13 = class Node$14 {
287704
287746
  return;
287705
287747
  console.log(...args$1);
287706
287748
  }, 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;
287707
- var init_src_osCd4WFE_es = __esm(() => {
287749
+ var init_src_yBJbeHWu_es = __esm(() => {
287708
287750
  init_rolldown_runtime_Bg48TavK_es();
287709
- init_SuperConverter_DKPcCGTm_es();
287751
+ init_SuperConverter_C87tnocN_es();
287710
287752
  init_jszip_C49i9kUs_es();
287711
287753
  init_uuid_qzgm05fK_es();
287712
- init_create_headless_toolbar_BTSQjUTS_es();
287754
+ init_create_headless_toolbar_sUHsO53v_es();
287713
287755
  init_constants_CGhJRd87_es();
287714
287756
  init_dist_B8HfvhaK_es();
287715
287757
  init_unified_Dsuw2be5_es();
@@ -288544,15 +288586,25 @@ ${err.toString()}`);
288544
288586
  addGlobalAttributes() {
288545
288587
  return [{
288546
288588
  types: this.options.types,
288547
- attributes: { fontFamily: {
288548
- default: null,
288549
- parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
288550
- renderDOM: (attrs) => {
288551
- if (!attrs.fontFamily)
288552
- return {};
288553
- return { style: `font-family: ${attrs.fontFamily}` };
288589
+ attributes: {
288590
+ fontFamily: {
288591
+ default: null,
288592
+ parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
288593
+ renderDOM: (attrs) => {
288594
+ if (!attrs.fontFamily)
288595
+ return {};
288596
+ return { style: `font-family: ${attrs.fontFamily}` };
288597
+ }
288598
+ },
288599
+ eastAsiaFontFamily: {
288600
+ default: null,
288601
+ rendered: false
288602
+ },
288603
+ csFontFamily: {
288604
+ default: null,
288605
+ rendered: false
288554
288606
  }
288555
- } }
288607
+ }
288556
288608
  }];
288557
288609
  },
288558
288610
  addCommands() {
@@ -322279,11 +322331,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
322279
322331
 
322280
322332
  // ../../packages/superdoc/dist/super-editor.es.js
322281
322333
  var init_super_editor_es = __esm(() => {
322282
- init_src_osCd4WFE_es();
322283
- init_SuperConverter_DKPcCGTm_es();
322334
+ init_src_yBJbeHWu_es();
322335
+ init_SuperConverter_C87tnocN_es();
322284
322336
  init_jszip_C49i9kUs_es();
322285
322337
  init_xml_js_CqGKpaft_es();
322286
- init_create_headless_toolbar_BTSQjUTS_es();
322338
+ init_create_headless_toolbar_sUHsO53v_es();
322287
322339
  init_constants_CGhJRd87_es();
322288
322340
  init_dist_B8HfvhaK_es();
322289
322341
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.5.0-next.76",
3
+ "version": "0.5.0-next.78",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
+ "superdoc": "1.25.0",
27
28
  "@superdoc/document-api": "0.0.1",
28
- "@superdoc/pm-adapter": "0.0.0",
29
29
  "@superdoc/super-editor": "0.0.1",
30
- "superdoc": "1.25.0"
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.76",
38
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.76",
39
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.76",
40
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.76",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.76"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.78",
38
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.78",
39
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.78",
40
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.78",
41
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.78"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",