@superdoc-dev/cli 0.2.0-next.124 → 0.2.0-next.125

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 +40 -77
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -135072,7 +135072,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
135072
135072
  init_remark_gfm_z_sDF4ss_es();
135073
135073
  });
135074
135074
 
135075
- // ../../packages/superdoc/dist/chunks/src-BV6PERs7.es.js
135075
+ // ../../packages/superdoc/dist/chunks/src-Gw0CeXiy.es.js
135076
135076
  function deleteProps(obj, propOrProps) {
135077
135077
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
135078
135078
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -202240,7 +202240,7 @@ var Node$13 = class Node$14 {
202240
202240
  pmStart: start$1,
202241
202241
  pmEnd: (typeof attrs.pmEnd === "number" ? attrs.pmEnd : undefined) ?? (start$1 != null ? start$1 + 1 : undefined)
202242
202242
  };
202243
- }, TWIPS_PER_INCH$1 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, twipsToPx$1 = (value) => value / TWIPS_PER_INCH$1 * 96, ptToPx = (pt) => {
202243
+ }, SUBSCRIPT_SUPERSCRIPT_SCALE2 = 0.65, TWIPS_PER_INCH$1 = 1440, PX_PER_PT2, VALID_TRACKED_MODES, DEFAULT_HYPERLINK_CONFIG, ATOMIC_INLINE_TYPES, TOKEN_INLINE_TYPES, twipsToPx$1 = (value) => value / TWIPS_PER_INCH$1 * 96, ptToPx = (pt) => {
202244
202244
  if (pt == null || !Number.isFinite(pt))
202245
202245
  return;
202246
202246
  return pt * PX_PER_PT2;
@@ -204124,6 +204124,8 @@ var Node$13 = class Node$14 {
204124
204124
  textRun.strike ? 1 : 0,
204125
204125
  textRun.highlight ?? "",
204126
204126
  textRun.letterSpacing != null ? textRun.letterSpacing : "",
204127
+ textRun.vertAlign ?? "",
204128
+ textRun.baselineShift != null ? textRun.baselineShift : "",
204127
204129
  textRun.token ?? "",
204128
204130
  textRun.trackedChange ? 1 : 0,
204129
204131
  textRun.comments?.length ?? 0
@@ -204305,6 +204307,8 @@ var Node$13 = class Node$14 {
204305
204307
  hash$3 = hashString(hash$3, getRunUnderlineStyle(run2));
204306
204308
  hash$3 = hashString(hash$3, getRunUnderlineColor(run2));
204307
204309
  hash$3 = hashString(hash$3, getRunBooleanProp(run2, "strike") ? "1" : "");
204310
+ hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
204311
+ hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
204308
204312
  }
204309
204313
  }
204310
204314
  }
@@ -204368,6 +204372,14 @@ var Node$13 = class Node$14 {
204368
204372
  decorations.push("line-through");
204369
204373
  if (decorations.length > 0)
204370
204374
  element3.style.textDecorationLine = decorations.join(" ");
204375
+ if (run2.baselineShift != null && Number.isFinite(run2.baselineShift))
204376
+ element3.style.verticalAlign = `${run2.baselineShift}pt`;
204377
+ else if (run2.vertAlign === "superscript")
204378
+ element3.style.verticalAlign = "super";
204379
+ else if (run2.vertAlign === "subscript")
204380
+ element3.style.verticalAlign = "sub";
204381
+ else if (run2.vertAlign === "baseline")
204382
+ element3.style.verticalAlign = "baseline";
204371
204383
  }, CLIP_PATH_PREFIXES, readClipPathValue = (value) => {
204372
204384
  if (typeof value !== "string")
204373
204385
  return "";
@@ -204846,6 +204858,8 @@ var Node$13 = class Node$14 {
204846
204858
  delete run2.highlight;
204847
204859
  delete run2.link;
204848
204860
  delete run2.letterSpacing;
204861
+ delete run2.vertAlign;
204862
+ delete run2.baselineShift;
204849
204863
  }, applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun$1, themeColors, enableComments = true) => {
204850
204864
  const tracked = run2.trackedChange;
204851
204865
  if (!tracked || tracked.kind !== "format")
@@ -205450,9 +205464,14 @@ var Node$13 = class Node$14 {
205450
205464
  fontFamily = resolveDocxFontFamily(runProps.fontFamily, converterContext.docx) || defaultFontFamily;
205451
205465
  else
205452
205466
  fontFamily = runProps.fontFamily?.ascii || runProps.fontFamily?.hAnsi || runProps.fontFamily?.eastAsia || defaultFontFamily;
205467
+ const vertAlign = runProps.vertAlign;
205468
+ const hasPosition = runProps.position != null && Number.isFinite(runProps.position);
205469
+ let fontSize = runProps.fontSize ? ptToPx(runProps.fontSize / 2) : defaultFontSizePx;
205470
+ if (!hasPosition && (vertAlign === "superscript" || vertAlign === "subscript"))
205471
+ fontSize *= SUBSCRIPT_SUPERSCRIPT_SCALE2;
205453
205472
  return {
205454
205473
  fontFamily: toCssFontFamily(fontFamily),
205455
- fontSize: runProps.fontSize ? ptToPx(runProps.fontSize / 2) : defaultFontSizePx,
205474
+ fontSize,
205456
205475
  bold: runProps.bold,
205457
205476
  italic: runProps.italic,
205458
205477
  underline: runProps.underline && runProps.underline["w:val"] && runProps.underline["w:val"] !== "none" ? {
@@ -205466,7 +205485,9 @@ var Node$13 = class Node$14 {
205466
205485
  allCaps: runProps?.textTransform === "uppercase",
205467
205486
  letterSpacing: runProps.letterSpacing ? twipsToPx$1(runProps.letterSpacing) : undefined,
205468
205487
  lang: runProps.lang?.val || undefined,
205469
- vanish: runProps.vanish
205488
+ vanish: runProps.vanish,
205489
+ vertAlign,
205490
+ baselineShift: hasPosition ? runProps.position / 2 : undefined
205470
205491
  };
205471
205492
  }, VALID_LINK_TARGETS, toTrimmedString = (value) => {
205472
205493
  if (typeof value !== "string")
@@ -205915,6 +205936,18 @@ var Node$13 = class Node$14 {
205915
205936
  if (transform === "uppercase" || transform === "lowercase" || transform === "capitalize" || transform === "none")
205916
205937
  run2.textTransform = transform;
205917
205938
  }
205939
+ if (typeof attrs.vertAlign === "string") {
205940
+ const va = attrs.vertAlign;
205941
+ if (va === "superscript" || va === "subscript" || va === "baseline")
205942
+ run2.vertAlign = va;
205943
+ }
205944
+ if (attrs.position != null && typeof attrs.position === "string") {
205945
+ const parsed = parseFloat(attrs.position);
205946
+ if (Number.isFinite(parsed))
205947
+ run2.baselineShift = parsed;
205948
+ }
205949
+ if (run2.baselineShift == null && (run2.vertAlign === "superscript" || run2.vertAlign === "subscript"))
205950
+ run2.fontSize *= SUBSCRIPT_SUPERSCRIPT_SCALE2;
205918
205951
  }, DEFAULT_HYPERLINK_CONFIG$1, applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, backgroundColor, enableComments = true) => {
205919
205952
  if (!enableComments && "comments" in run2 && run2.comments)
205920
205953
  delete run2.comments;
@@ -212753,7 +212786,7 @@ var Node$13 = class Node$14 {
212753
212786
  this.#hoverRegion = null;
212754
212787
  this.#overlayManager = null;
212755
212788
  }
212756
- }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, SUBSCRIPT_SUPERSCRIPT_SCALE2 = 0.65, DEFAULT_PAGE_SIZE, DEFAULT_MARGINS, DEFAULT_PAGE_GAP = 24, DEFAULT_HORIZONTAL_PAGE_GAP = 20, layoutDebugEnabled, perfLog = (...args$1) => {
212789
+ }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, DEFAULT_PAGE_SIZE, DEFAULT_MARGINS, DEFAULT_PAGE_GAP = 24, DEFAULT_HORIZONTAL_PAGE_GAP = 20, layoutDebugEnabled, perfLog = (...args$1) => {
212757
212790
  if (!layoutDebugEnabled)
212758
212791
  return;
212759
212792
  console.log(...args$1);
@@ -217758,7 +217791,7 @@ var Node$13 = class Node$14 {
217758
217791
  return false;
217759
217792
  return Boolean(checker(attrs));
217760
217793
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
217761
- var init_src_BV6PERs7_es = __esm(() => {
217794
+ var init_src_Gw0CeXiy_es = __esm(() => {
217762
217795
  init_rolldown_runtime_B2q5OVn9_es();
217763
217796
  init_SuperConverter_Cw5CEerM_es();
217764
217797
  init_jszip_ChlR43oI_es();
@@ -238549,7 +238582,6 @@ function print() { __p += __j.call(arguments, '') }
238549
238582
  painter.paint(layout, this.#painterHost, mapping ?? undefined);
238550
238583
  perfLog(`[Perf] painter.paint: ${(perfNow() - painterPaintStart).toFixed(2)}ms`);
238551
238584
  const painterPostStart = perfNow();
238552
- this.#applyVertAlignToLayout();
238553
238585
  this.#rebuildDomPositionIndex();
238554
238586
  this.#syncDecorations();
238555
238587
  this.#domIndexObserverManager?.resume();
@@ -239829,75 +239861,6 @@ function print() { __p += __j.call(arguments, '') }
239829
239861
  return false;
239830
239862
  return this.#documentMode === "viewing";
239831
239863
  }
239832
- #applyVertAlignToLayout() {
239833
- const doc$2 = this.#editor?.state?.doc;
239834
- if (!doc$2 || !this.#painterHost)
239835
- return;
239836
- try {
239837
- this.#painterHost.querySelectorAll(".superdoc-line span[data-pm-start]").forEach((span) => {
239838
- try {
239839
- if (span.closest(".superdoc-page-header, .superdoc-page-footer"))
239840
- return;
239841
- const pmStart = Number(span.dataset.pmStart ?? "NaN");
239842
- if (!Number.isFinite(pmStart))
239843
- return;
239844
- const pos = Math.max(0, Math.min(pmStart, doc$2.content.size));
239845
- const $pos = doc$2.resolve(pos);
239846
- let runNode = null;
239847
- for (let depth = $pos.depth;depth >= 0; depth--) {
239848
- const node3 = $pos.node(depth);
239849
- if (node3.type.name === "run") {
239850
- runNode = node3;
239851
- break;
239852
- }
239853
- }
239854
- let vertAlign = runNode?.attrs?.runProperties?.vertAlign ?? null;
239855
- let position4 = runNode?.attrs?.runProperties?.position ?? null;
239856
- let fontSizeHalfPts = runNode?.attrs?.runProperties?.fontSize ?? null;
239857
- if (!vertAlign && position4 == null && runNode)
239858
- runNode.forEach((child) => {
239859
- if (!child.isText || !child.marks?.length)
239860
- return;
239861
- const rpr = decodeRPrFromMarks(child.marks);
239862
- if (rpr.vertAlign && !vertAlign)
239863
- vertAlign = rpr.vertAlign;
239864
- if (rpr.position != null && position4 == null)
239865
- position4 = rpr.position;
239866
- if (rpr.fontSize != null && fontSizeHalfPts == null)
239867
- fontSizeHalfPts = rpr.fontSize;
239868
- });
239869
- if (vertAlign == null && position4 == null)
239870
- return;
239871
- const styleEntries = [];
239872
- if (position4 != null && Number.isFinite(position4)) {
239873
- const pts = halfPointToPoints(position4);
239874
- if (Number.isFinite(pts))
239875
- styleEntries.push(`vertical-align: ${pts}pt`);
239876
- } else if (vertAlign === "superscript" || vertAlign === "subscript") {
239877
- styleEntries.push(`vertical-align: ${vertAlign === "superscript" ? "super" : "sub"}`);
239878
- if (fontSizeHalfPts != null && Number.isFinite(fontSizeHalfPts)) {
239879
- const scaledPts = halfPointToPoints(fontSizeHalfPts * SUBSCRIPT_SUPERSCRIPT_SCALE2);
239880
- if (Number.isFinite(scaledPts))
239881
- styleEntries.push(`font-size: ${scaledPts}pt`);
239882
- else
239883
- styleEntries.push(`font-size: ${SUBSCRIPT_SUPERSCRIPT_SCALE2 * 100}%`);
239884
- } else
239885
- styleEntries.push(`font-size: ${SUBSCRIPT_SUPERSCRIPT_SCALE2 * 100}%`);
239886
- } else if (vertAlign === "baseline")
239887
- styleEntries.push("vertical-align: baseline");
239888
- if (!styleEntries.length)
239889
- return;
239890
- const existing = span.getAttribute("style");
239891
- const merged = existing ? `${existing}; ${styleEntries.join("; ")}` : styleEntries.join("; ");
239892
- span.setAttribute("style", merged);
239893
- } catch (error) {
239894
- console.error("Failed to apply vertical alignment to span:", error);
239895
- }
239896
- });
239897
- } catch (error) {
239898
- console.error("Failed to apply vertical alignment to layout:", error);
239899
- }
239900
- }
239901
239864
  };
239902
239865
  Color = Extension.create({
239903
239866
  name: "color",
@@ -251429,7 +251392,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
251429
251392
 
251430
251393
  // ../../packages/superdoc/dist/super-editor.es.js
251431
251394
  var init_super_editor_es = __esm(() => {
251432
- init_src_BV6PERs7_es();
251395
+ init_src_Gw0CeXiy_es();
251433
251396
  init_SuperConverter_Cw5CEerM_es();
251434
251397
  init_jszip_ChlR43oI_es();
251435
251398
  init_xml_js_DLE8mr0n_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.124",
3
+ "version": "0.2.0-next.125",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,21 +20,21 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
- "@superdoc/document-api": "0.0.1",
24
23
  "@superdoc/pm-adapter": "0.0.0",
24
+ "@superdoc/super-editor": "0.0.1",
25
25
  "superdoc": "1.18.0",
26
- "@superdoc/super-editor": "0.0.1"
26
+ "@superdoc/document-api": "0.0.1"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.124",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.124",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.124",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.124",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.124"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.125",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.125",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.125",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.125",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.125"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",