@superdoc-dev/cli 0.5.0-next.77 → 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 +84 -35
  2. package/package.json +9 -9
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--qnhRLCa.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);
@@ -117507,7 +117546,7 @@ var isRegExp = (value) => {
117507
117546
  state.kern = kernNode.attributes["w:val"];
117508
117547
  }
117509
117548
  }, SuperConverter;
117510
- var init_SuperConverter_qnhRLCa_es = __esm(() => {
117549
+ var init_SuperConverter_C87tnocN_es = __esm(() => {
117511
117550
  init_rolldown_runtime_Bg48TavK_es();
117512
117551
  init_jszip_C49i9kUs_es();
117513
117552
  init_xml_js_CqGKpaft_es();
@@ -154599,7 +154638,7 @@ var init_SuperConverter_qnhRLCa_es = __esm(() => {
154599
154638
  };
154600
154639
  });
154601
154640
 
154602
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DSyaYMVl.es.js
154641
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-sUHsO53v.es.js
154603
154642
  function parseSizeUnit(val = "0") {
154604
154643
  const length3 = val.toString() || "0";
154605
154644
  const value = Number.parseFloat(length3);
@@ -156210,8 +156249,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
156210
156249
  return false;
156211
156250
  return Boolean(checker(attrs));
156212
156251
  };
156213
- var init_create_headless_toolbar_DSyaYMVl_es = __esm(() => {
156214
- init_SuperConverter_qnhRLCa_es();
156252
+ var init_create_headless_toolbar_sUHsO53v_es = __esm(() => {
156253
+ init_SuperConverter_C87tnocN_es();
156215
156254
  init_constants_CGhJRd87_es();
156216
156255
  init_dist_B8HfvhaK_es();
156217
156256
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -204649,7 +204688,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204649
204688
  init_remark_gfm_BhnWr3yf_es();
204650
204689
  });
204651
204690
 
204652
- // ../../packages/superdoc/dist/chunks/src-CFXu8Kfm.es.js
204691
+ // ../../packages/superdoc/dist/chunks/src-yBJbeHWu.es.js
204653
204692
  function deleteProps(obj, propOrProps) {
204654
204693
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204655
204694
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -287707,12 +287746,12 @@ var Node$13 = class Node$14 {
287707
287746
  return;
287708
287747
  console.log(...args$1);
287709
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;
287710
- var init_src_CFXu8Kfm_es = __esm(() => {
287749
+ var init_src_yBJbeHWu_es = __esm(() => {
287711
287750
  init_rolldown_runtime_Bg48TavK_es();
287712
- init_SuperConverter_qnhRLCa_es();
287751
+ init_SuperConverter_C87tnocN_es();
287713
287752
  init_jszip_C49i9kUs_es();
287714
287753
  init_uuid_qzgm05fK_es();
287715
- init_create_headless_toolbar_DSyaYMVl_es();
287754
+ init_create_headless_toolbar_sUHsO53v_es();
287716
287755
  init_constants_CGhJRd87_es();
287717
287756
  init_dist_B8HfvhaK_es();
287718
287757
  init_unified_Dsuw2be5_es();
@@ -288547,15 +288586,25 @@ ${err.toString()}`);
288547
288586
  addGlobalAttributes() {
288548
288587
  return [{
288549
288588
  types: this.options.types,
288550
- attributes: { fontFamily: {
288551
- default: null,
288552
- parseDOM: (el) => el.style.fontFamily?.replace(/['"]+/g, ""),
288553
- renderDOM: (attrs) => {
288554
- if (!attrs.fontFamily)
288555
- return {};
288556
- 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
288557
288606
  }
288558
- } }
288607
+ }
288559
288608
  }];
288560
288609
  },
288561
288610
  addCommands() {
@@ -322282,11 +322331,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
322282
322331
 
322283
322332
  // ../../packages/superdoc/dist/super-editor.es.js
322284
322333
  var init_super_editor_es = __esm(() => {
322285
- init_src_CFXu8Kfm_es();
322286
- init_SuperConverter_qnhRLCa_es();
322334
+ init_src_yBJbeHWu_es();
322335
+ init_SuperConverter_C87tnocN_es();
322287
322336
  init_jszip_C49i9kUs_es();
322288
322337
  init_xml_js_CqGKpaft_es();
322289
- init_create_headless_toolbar_DSyaYMVl_es();
322338
+ init_create_headless_toolbar_sUHsO53v_es();
322290
322339
  init_constants_CGhJRd87_es();
322291
322340
  init_dist_B8HfvhaK_es();
322292
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.77",
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/document-api": "0.0.1",
28
- "@superdoc/pm-adapter": "0.0.0",
29
27
  "superdoc": "1.25.0",
30
- "@superdoc/super-editor": "0.0.1"
28
+ "@superdoc/document-api": "0.0.1",
29
+ "@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.77",
38
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.77",
39
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.77",
40
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.77",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.77"
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",