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

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 +72 -80
  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-CfMc8y28.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) => {
@@ -197545,10 +197545,29 @@ var Node$13 = class Node$14 {
197545
197545
  newTr.setMeta(CommentsPluginKey, { type: "force" });
197546
197546
  }, require_lodash, import_lodash$1, normalizeAttrs = (attrs = {}) => {
197547
197547
  return Object.fromEntries(Object.entries(attrs).filter(([, value]) => value !== null && value !== undefined));
197548
- }, attrsExactlyMatch = (left$1 = {}, right$1 = {}) => {
197549
- return (0, import_lodash$1.isEqual)(normalizeAttrs(left$1), normalizeAttrs(right$1));
197548
+ }, IDENTITY_ATTR_VALUES, ATTRIBUTE_ONLY_MARKS, normalizeSnapshotAttrs = (attrs = {}) => {
197549
+ const base$1 = normalizeAttrs(attrs);
197550
+ return Object.fromEntries(Object.entries(base$1).filter(([key$1, value]) => IDENTITY_ATTR_VALUES[key$1] !== value));
197550
197551
  }, getTypeName = (markLike) => {
197551
197552
  return markLike?.type?.name ?? markLike?.type;
197553
+ }, isTrackFormatNoOp = (before, after) => {
197554
+ const normalize$1 = (entries) => entries.map((s2) => ({
197555
+ type: getTypeName(s2),
197556
+ attrs: normalizeSnapshotAttrs(s2.attrs || {})
197557
+ })).filter((s2) => {
197558
+ if (ATTRIBUTE_ONLY_MARKS.includes(s2.type) && Object.keys(s2.attrs).length === 0)
197559
+ return false;
197560
+ return true;
197561
+ });
197562
+ const normBefore = normalize$1(before);
197563
+ const normAfter = normalize$1(after);
197564
+ if (normBefore.length === 0 && normAfter.length === 0)
197565
+ return true;
197566
+ if (normBefore.length !== normAfter.length)
197567
+ return false;
197568
+ return normBefore.every((b$1) => normAfter.some((a2) => a2.type === b$1.type && (0, import_lodash$1.isEqual)(a2.attrs, b$1.attrs))) && normAfter.every((a2) => normBefore.some((b$1) => b$1.type === a2.type && (0, import_lodash$1.isEqual)(b$1.attrs, a2.attrs)));
197569
+ }, attrsExactlyMatch = (left$1 = {}, right$1 = {}) => {
197570
+ return (0, import_lodash$1.isEqual)(normalizeAttrs(left$1), normalizeAttrs(right$1));
197552
197571
  }, marksMatch = (left$1, right$1, exact = true) => {
197553
197572
  if (!left$1 || !right$1 || getTypeName(left$1) !== getTypeName(right$1))
197554
197573
  return false;
@@ -197651,7 +197670,7 @@ var Node$13 = class Node$14 {
197651
197670
  if (formatChangeMark)
197652
197671
  if (formatChangeMark.attrs.before.find((mark2) => markSnapshotMatchesStepMark(mark2, step3.mark, true))) {
197653
197672
  before = [...formatChangeMark.attrs.before.filter((mark2) => !markSnapshotMatchesStepMark(mark2, step3.mark, true))];
197654
- after = [...formatChangeMark.attrs.after];
197673
+ after = formatChangeMark.attrs.after.filter((mark2) => getTypeName(mark2) !== step3.mark.type.name);
197655
197674
  } else {
197656
197675
  before = [...formatChangeMark.attrs.before];
197657
197676
  after = upsertMarkSnapshotByType(formatChangeMark.attrs.after, {
@@ -197670,6 +197689,11 @@ var Node$13 = class Node$14 {
197670
197689
  attrs: { ...step3.mark.attrs }
197671
197690
  }];
197672
197691
  }
197692
+ if (isTrackFormatNoOp(before, after)) {
197693
+ if (formatChangeMark)
197694
+ newTr.removeMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), formatChangeMark);
197695
+ return;
197696
+ }
197673
197697
  if (after.length || before.length) {
197674
197698
  const newFormatMark = state.schema.marks[TrackFormatMarkName].create({
197675
197699
  id: wid,
@@ -202240,7 +202264,7 @@ var Node$13 = class Node$14 {
202240
202264
  pmStart: start$1,
202241
202265
  pmEnd: (typeof attrs.pmEnd === "number" ? attrs.pmEnd : undefined) ?? (start$1 != null ? start$1 + 1 : undefined)
202242
202266
  };
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) => {
202267
+ }, 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
202268
  if (pt == null || !Number.isFinite(pt))
202245
202269
  return;
202246
202270
  return pt * PX_PER_PT2;
@@ -204124,6 +204148,8 @@ var Node$13 = class Node$14 {
204124
204148
  textRun.strike ? 1 : 0,
204125
204149
  textRun.highlight ?? "",
204126
204150
  textRun.letterSpacing != null ? textRun.letterSpacing : "",
204151
+ textRun.vertAlign ?? "",
204152
+ textRun.baselineShift != null ? textRun.baselineShift : "",
204127
204153
  textRun.token ?? "",
204128
204154
  textRun.trackedChange ? 1 : 0,
204129
204155
  textRun.comments?.length ?? 0
@@ -204305,6 +204331,8 @@ var Node$13 = class Node$14 {
204305
204331
  hash$3 = hashString(hash$3, getRunUnderlineStyle(run2));
204306
204332
  hash$3 = hashString(hash$3, getRunUnderlineColor(run2));
204307
204333
  hash$3 = hashString(hash$3, getRunBooleanProp(run2, "strike") ? "1" : "");
204334
+ hash$3 = hashString(hash$3, getRunStringProp(run2, "vertAlign"));
204335
+ hash$3 = hashNumber(hash$3, getRunNumberProp(run2, "baselineShift"));
204308
204336
  }
204309
204337
  }
204310
204338
  }
@@ -204368,6 +204396,14 @@ var Node$13 = class Node$14 {
204368
204396
  decorations.push("line-through");
204369
204397
  if (decorations.length > 0)
204370
204398
  element3.style.textDecorationLine = decorations.join(" ");
204399
+ if (run2.baselineShift != null && Number.isFinite(run2.baselineShift))
204400
+ element3.style.verticalAlign = `${run2.baselineShift}pt`;
204401
+ else if (run2.vertAlign === "superscript")
204402
+ element3.style.verticalAlign = "super";
204403
+ else if (run2.vertAlign === "subscript")
204404
+ element3.style.verticalAlign = "sub";
204405
+ else if (run2.vertAlign === "baseline")
204406
+ element3.style.verticalAlign = "baseline";
204371
204407
  }, CLIP_PATH_PREFIXES, readClipPathValue = (value) => {
204372
204408
  if (typeof value !== "string")
204373
204409
  return "";
@@ -204846,6 +204882,8 @@ var Node$13 = class Node$14 {
204846
204882
  delete run2.highlight;
204847
204883
  delete run2.link;
204848
204884
  delete run2.letterSpacing;
204885
+ delete run2.vertAlign;
204886
+ delete run2.baselineShift;
204849
204887
  }, applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun$1, themeColors, enableComments = true) => {
204850
204888
  const tracked = run2.trackedChange;
204851
204889
  if (!tracked || tracked.kind !== "format")
@@ -205450,9 +205488,14 @@ var Node$13 = class Node$14 {
205450
205488
  fontFamily = resolveDocxFontFamily(runProps.fontFamily, converterContext.docx) || defaultFontFamily;
205451
205489
  else
205452
205490
  fontFamily = runProps.fontFamily?.ascii || runProps.fontFamily?.hAnsi || runProps.fontFamily?.eastAsia || defaultFontFamily;
205491
+ const vertAlign = runProps.vertAlign;
205492
+ const hasPosition = runProps.position != null && Number.isFinite(runProps.position);
205493
+ let fontSize = runProps.fontSize ? ptToPx(runProps.fontSize / 2) : defaultFontSizePx;
205494
+ if (!hasPosition && (vertAlign === "superscript" || vertAlign === "subscript"))
205495
+ fontSize *= SUBSCRIPT_SUPERSCRIPT_SCALE2;
205453
205496
  return {
205454
205497
  fontFamily: toCssFontFamily(fontFamily),
205455
- fontSize: runProps.fontSize ? ptToPx(runProps.fontSize / 2) : defaultFontSizePx,
205498
+ fontSize,
205456
205499
  bold: runProps.bold,
205457
205500
  italic: runProps.italic,
205458
205501
  underline: runProps.underline && runProps.underline["w:val"] && runProps.underline["w:val"] !== "none" ? {
@@ -205466,7 +205509,9 @@ var Node$13 = class Node$14 {
205466
205509
  allCaps: runProps?.textTransform === "uppercase",
205467
205510
  letterSpacing: runProps.letterSpacing ? twipsToPx$1(runProps.letterSpacing) : undefined,
205468
205511
  lang: runProps.lang?.val || undefined,
205469
- vanish: runProps.vanish
205512
+ vanish: runProps.vanish,
205513
+ vertAlign,
205514
+ baselineShift: hasPosition ? runProps.position / 2 : undefined
205470
205515
  };
205471
205516
  }, VALID_LINK_TARGETS, toTrimmedString = (value) => {
205472
205517
  if (typeof value !== "string")
@@ -205915,6 +205960,18 @@ var Node$13 = class Node$14 {
205915
205960
  if (transform === "uppercase" || transform === "lowercase" || transform === "capitalize" || transform === "none")
205916
205961
  run2.textTransform = transform;
205917
205962
  }
205963
+ if (typeof attrs.vertAlign === "string") {
205964
+ const va = attrs.vertAlign;
205965
+ if (va === "superscript" || va === "subscript" || va === "baseline")
205966
+ run2.vertAlign = va;
205967
+ }
205968
+ if (attrs.position != null && typeof attrs.position === "string") {
205969
+ const parsed = parseFloat(attrs.position);
205970
+ if (Number.isFinite(parsed))
205971
+ run2.baselineShift = parsed;
205972
+ }
205973
+ if (run2.baselineShift == null && (run2.vertAlign === "superscript" || run2.vertAlign === "subscript"))
205974
+ run2.fontSize *= SUBSCRIPT_SUPERSCRIPT_SCALE2;
205918
205975
  }, DEFAULT_HYPERLINK_CONFIG$1, applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, backgroundColor, enableComments = true) => {
205919
205976
  if (!enableComments && "comments" in run2 && run2.comments)
205920
205977
  delete run2.comments;
@@ -212753,7 +212810,7 @@ var Node$13 = class Node$14 {
212753
212810
  this.#hoverRegion = null;
212754
212811
  this.#overlayManager = null;
212755
212812
  }
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) => {
212813
+ }, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, DEFAULT_PAGE_SIZE, DEFAULT_MARGINS, DEFAULT_PAGE_GAP = 24, DEFAULT_HORIZONTAL_PAGE_GAP = 20, layoutDebugEnabled, perfLog = (...args$1) => {
212757
212814
  if (!layoutDebugEnabled)
212758
212815
  return;
212759
212816
  console.log(...args$1);
@@ -217758,7 +217815,7 @@ var Node$13 = class Node$14 {
217758
217815
  return false;
217759
217816
  return Boolean(checker(attrs));
217760
217817
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
217761
- var init_src_BV6PERs7_es = __esm(() => {
217818
+ var init_src_CfMc8y28_es = __esm(() => {
217762
217819
  init_rolldown_runtime_B2q5OVn9_es();
217763
217820
  init_SuperConverter_Cw5CEerM_es();
217764
217821
  init_jszip_ChlR43oI_es();
@@ -225386,6 +225443,11 @@ function print() { __p += __j.call(arguments, '') }
225386
225443
  }).call(exports);
225387
225444
  });
225388
225445
  import_lodash$1 = require_lodash();
225446
+ IDENTITY_ATTR_VALUES = {
225447
+ vertAlign: "baseline",
225448
+ position: "0pt"
225449
+ };
225450
+ ATTRIBUTE_ONLY_MARKS = ["textStyle"];
225389
225451
  DOCUMENT_MIGRATIONS = { initial: migration_after_0_4_14 };
225390
225452
  AnnotatorHelpers = {
225391
225453
  getFieldAttrs,
@@ -238549,7 +238611,6 @@ function print() { __p += __j.call(arguments, '') }
238549
238611
  painter.paint(layout, this.#painterHost, mapping ?? undefined);
238550
238612
  perfLog(`[Perf] painter.paint: ${(perfNow() - painterPaintStart).toFixed(2)}ms`);
238551
238613
  const painterPostStart = perfNow();
238552
- this.#applyVertAlignToLayout();
238553
238614
  this.#rebuildDomPositionIndex();
238554
238615
  this.#syncDecorations();
238555
238616
  this.#domIndexObserverManager?.resume();
@@ -239829,75 +239890,6 @@ function print() { __p += __j.call(arguments, '') }
239829
239890
  return false;
239830
239891
  return this.#documentMode === "viewing";
239831
239892
  }
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
239893
  };
239902
239894
  Color = Extension.create({
239903
239895
  name: "color",
@@ -251429,7 +251421,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
251429
251421
 
251430
251422
  // ../../packages/superdoc/dist/super-editor.es.js
251431
251423
  var init_super_editor_es = __esm(() => {
251432
- init_src_BV6PERs7_es();
251424
+ init_src_CfMc8y28_es();
251433
251425
  init_SuperConverter_Cw5CEerM_es();
251434
251426
  init_jszip_ChlR43oI_es();
251435
251427
  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.126",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,20 +21,20 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
+ "@superdoc/super-editor": "0.0.1",
24
25
  "@superdoc/pm-adapter": "0.0.0",
25
- "superdoc": "1.18.0",
26
- "@superdoc/super-editor": "0.0.1"
26
+ "superdoc": "1.18.0"
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.126",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.126",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.126",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.126",
37
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.126"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",