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

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 +63 -9
  2. package/package.json +6 -6
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-Gw0CeXiy.es.js
135075
+ // ../../packages/superdoc/dist/chunks/src-gn4Pflqy.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) => {
@@ -184850,7 +184850,7 @@ function computeAnchorMap(bookmarks, layout, blocks2) {
184850
184850
  });
184851
184851
  return anchorMap;
184852
184852
  }
184853
- async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
184853
+ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollContainer, zoom, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
184854
184854
  if (!anchor)
184855
184855
  return false;
184856
184856
  if (!layout)
@@ -184862,9 +184862,11 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
184862
184862
  if (pmPos == null)
184863
184863
  return false;
184864
184864
  let pageIndex = (selectionToRects(layout, blocks2, measures, pmPos, pmPos + 1, pageGeometryHelper) ?? [])[0]?.pageIndex ?? null;
184865
+ let fragmentY = null;
184865
184866
  if (pageIndex == null) {
184866
184867
  let nextFragmentPage = null;
184867
184868
  let nextFragmentStart = null;
184869
+ let nextFragmentY = null;
184868
184870
  for (const page of layout.pages) {
184869
184871
  for (const fragment2 of page.fragments) {
184870
184872
  if (fragment2.kind !== "para")
@@ -184875,25 +184877,46 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
184875
184877
  continue;
184876
184878
  if (pmPos >= fragStart && pmPos < fragEnd) {
184877
184879
  pageIndex = page.number - 1;
184880
+ fragmentY = fragment2.y;
184878
184881
  break;
184879
184882
  }
184880
184883
  if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
184881
184884
  nextFragmentPage = page.number - 1;
184882
184885
  nextFragmentStart = fragStart;
184886
+ nextFragmentY = fragment2.y;
184883
184887
  }
184884
184888
  }
184885
184889
  if (pageIndex != null)
184886
184890
  break;
184887
184891
  }
184888
- if (pageIndex == null && nextFragmentPage != null)
184892
+ if (pageIndex == null && nextFragmentPage != null) {
184889
184893
  pageIndex = nextFragmentPage;
184894
+ fragmentY = nextFragmentY;
184895
+ }
184890
184896
  }
184891
184897
  if (pageIndex == null)
184892
184898
  return false;
184893
184899
  scrollPageIntoView(pageIndex);
184894
184900
  await waitForPageMount(pageIndex, timeoutMs);
184895
184901
  const pageEl = getPageElementByIndex(painterHost, pageIndex);
184896
- if (pageEl)
184902
+ if (pageEl && fragmentY != null) {
184903
+ const scaledY = fragmentY * zoom;
184904
+ if (scrollContainer instanceof Element) {
184905
+ const pageRect = pageEl.getBoundingClientRect();
184906
+ const containerRect = scrollContainer.getBoundingClientRect();
184907
+ const targetY = pageRect.top - containerRect.top + scrollContainer.scrollTop + scaledY;
184908
+ scrollContainer.scrollTo({
184909
+ top: targetY,
184910
+ behavior: "instant"
184911
+ });
184912
+ } else {
184913
+ const targetY = pageEl.getBoundingClientRect().top + scrollContainer.scrollY + scaledY;
184914
+ scrollContainer.scrollTo({
184915
+ top: targetY,
184916
+ behavior: "instant"
184917
+ });
184918
+ }
184919
+ } else if (pageEl)
184897
184920
  pageEl.scrollIntoView({
184898
184921
  behavior: "instant",
184899
184922
  block: "start"
@@ -197545,10 +197568,29 @@ var Node$13 = class Node$14 {
197545
197568
  newTr.setMeta(CommentsPluginKey, { type: "force" });
197546
197569
  }, require_lodash, import_lodash$1, normalizeAttrs = (attrs = {}) => {
197547
197570
  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));
197571
+ }, IDENTITY_ATTR_VALUES, ATTRIBUTE_ONLY_MARKS, normalizeSnapshotAttrs = (attrs = {}) => {
197572
+ const base$1 = normalizeAttrs(attrs);
197573
+ return Object.fromEntries(Object.entries(base$1).filter(([key$1, value]) => IDENTITY_ATTR_VALUES[key$1] !== value));
197550
197574
  }, getTypeName = (markLike) => {
197551
197575
  return markLike?.type?.name ?? markLike?.type;
197576
+ }, isTrackFormatNoOp = (before, after) => {
197577
+ const normalize$1 = (entries) => entries.map((s2) => ({
197578
+ type: getTypeName(s2),
197579
+ attrs: normalizeSnapshotAttrs(s2.attrs || {})
197580
+ })).filter((s2) => {
197581
+ if (ATTRIBUTE_ONLY_MARKS.includes(s2.type) && Object.keys(s2.attrs).length === 0)
197582
+ return false;
197583
+ return true;
197584
+ });
197585
+ const normBefore = normalize$1(before);
197586
+ const normAfter = normalize$1(after);
197587
+ if (normBefore.length === 0 && normAfter.length === 0)
197588
+ return true;
197589
+ if (normBefore.length !== normAfter.length)
197590
+ return false;
197591
+ 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)));
197592
+ }, attrsExactlyMatch = (left$1 = {}, right$1 = {}) => {
197593
+ return (0, import_lodash$1.isEqual)(normalizeAttrs(left$1), normalizeAttrs(right$1));
197552
197594
  }, marksMatch = (left$1, right$1, exact = true) => {
197553
197595
  if (!left$1 || !right$1 || getTypeName(left$1) !== getTypeName(right$1))
197554
197596
  return false;
@@ -197651,7 +197693,7 @@ var Node$13 = class Node$14 {
197651
197693
  if (formatChangeMark)
197652
197694
  if (formatChangeMark.attrs.before.find((mark2) => markSnapshotMatchesStepMark(mark2, step3.mark, true))) {
197653
197695
  before = [...formatChangeMark.attrs.before.filter((mark2) => !markSnapshotMatchesStepMark(mark2, step3.mark, true))];
197654
- after = [...formatChangeMark.attrs.after];
197696
+ after = formatChangeMark.attrs.after.filter((mark2) => getTypeName(mark2) !== step3.mark.type.name);
197655
197697
  } else {
197656
197698
  before = [...formatChangeMark.attrs.before];
197657
197699
  after = upsertMarkSnapshotByType(formatChangeMark.attrs.after, {
@@ -197670,6 +197712,11 @@ var Node$13 = class Node$14 {
197670
197712
  attrs: { ...step3.mark.attrs }
197671
197713
  }];
197672
197714
  }
197715
+ if (isTrackFormatNoOp(before, after)) {
197716
+ if (formatChangeMark)
197717
+ newTr.removeMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), formatChangeMark);
197718
+ return;
197719
+ }
197673
197720
  if (after.length || before.length) {
197674
197721
  const newFormatMark = state.schema.marks[TrackFormatMarkName].create({
197675
197722
  id: wid,
@@ -217791,7 +217838,7 @@ var Node$13 = class Node$14 {
217791
217838
  return false;
217792
217839
  return Boolean(checker(attrs));
217793
217840
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
217794
- var init_src_Gw0CeXiy_es = __esm(() => {
217841
+ var init_src_gn4Pflqy_es = __esm(() => {
217795
217842
  init_rolldown_runtime_B2q5OVn9_es();
217796
217843
  init_SuperConverter_Cw5CEerM_es();
217797
217844
  init_jszip_ChlR43oI_es();
@@ -225419,6 +225466,11 @@ function print() { __p += __j.call(arguments, '') }
225419
225466
  }).call(exports);
225420
225467
  });
225421
225468
  import_lodash$1 = require_lodash();
225469
+ IDENTITY_ATTR_VALUES = {
225470
+ vertAlign: "baseline",
225471
+ position: "0pt"
225472
+ };
225473
+ ATTRIBUTE_ONLY_MARKS = ["textStyle"];
225422
225474
  DOCUMENT_MIGRATIONS = { initial: migration_after_0_4_14 };
225423
225475
  AnnotatorHelpers = {
225424
225476
  getFieldAttrs,
@@ -239443,6 +239495,8 @@ function print() { __p += __j.call(arguments, '') }
239443
239495
  bookmarks: this.#layoutState.bookmarks,
239444
239496
  pageGeometryHelper: this.#pageGeometryHelper ?? undefined,
239445
239497
  painterHost: this.#painterHost,
239498
+ scrollContainer: this.#scrollContainer ?? this.#visibleHost,
239499
+ zoom: this.zoom,
239446
239500
  scrollPageIntoView: (pageIndex) => this.#scrollPageIntoView(pageIndex),
239447
239501
  waitForPageMount: (pageIndex, timeoutMs) => this.#waitForPageMount(pageIndex, { timeout: timeoutMs }),
239448
239502
  getActiveEditor: () => this.getActiveEditor(),
@@ -251392,7 +251446,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
251392
251446
 
251393
251447
  // ../../packages/superdoc/dist/super-editor.es.js
251394
251448
  var init_super_editor_es = __esm(() => {
251395
- init_src_Gw0CeXiy_es();
251449
+ init_src_gn4Pflqy_es();
251396
251450
  init_SuperConverter_Cw5CEerM_es();
251397
251451
  init_jszip_ChlR43oI_es();
251398
251452
  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.125",
3
+ "version": "0.2.0-next.127",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
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"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.127",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.127",
35
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.127",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.127",
37
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.127"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",