@superdoc-dev/cli 0.15.0-next.9 → 0.15.0

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 +122 -39
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -221759,7 +221759,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
221759
221759
  init_remark_gfm_BhnWr3yf_es();
221760
221760
  });
221761
221761
 
221762
- // ../../packages/superdoc/dist/chunks/src-DQ_lu_9z.es.js
221762
+ // ../../packages/superdoc/dist/chunks/src-Bm7Xq4ys.es.js
221763
221763
  function deleteProps(obj, propOrProps) {
221764
221764
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
221765
221765
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -291584,7 +291584,7 @@ var Node$13 = class Node$14 {
291584
291584
  }
291585
291585
  });
291586
291586
  }
291587
- }, COMPOSITION_INPUT_TYPES, COMBINING_MARK_REGEX, graphemeSegmenter, DEAD_KEY_PLACEHOLDER_MARKS, getTextNodeAtPos = ({ doc: doc$12, pos }) => {
291587
+ }, COMPOSITION_INPUT_TYPES, COMBINING_MARK_REGEX, graphemeSegmenter, DEAD_KEY_PLACEHOLDER_MARKS, TRACKABLE_META_KEYS, PASSTHROUGH_META_KEYS, ALLOWED_META_KEYS, getTextNodeAtPos = ({ doc: doc$12, pos }) => {
291588
291588
  let found2 = null;
291589
291589
  doc$12.nodesBetween(Math.max(0, pos - 1), Math.min(doc$12.content.size, pos + 1), (node3, nodePos) => {
291590
291590
  if (found2 || !node3.isText || !node3.text)
@@ -291775,6 +291775,12 @@ var Node$13 = class Node$14 {
291775
291775
  ...existingMeta,
291776
291776
  ...extraMeta
291777
291777
  });
291778
+ }, copyPassthroughMeta = (sourceTr, targetTr) => {
291779
+ PASSTHROUGH_META_KEYS.forEach((key2) => {
291780
+ const value = sourceTr.getMeta(key2);
291781
+ if (value !== undefined)
291782
+ targetTr.setMeta(key2, value);
291783
+ });
291778
291784
  }, getPendingDeadKeyPlaceholder = ({ tr, newTr, user }) => {
291779
291785
  if (!isCompositionTransaction(tr) || tr.steps.length !== 1)
291780
291786
  return null;
@@ -291804,13 +291810,6 @@ var Node$13 = class Node$14 {
291804
291810
  authorEmail: user.email
291805
291811
  };
291806
291812
  }, trackedTransaction = ({ tr, state, user, replacements = "paired" }) => {
291807
- const onlyInputTypeMeta = [
291808
- "inputType",
291809
- "uiEvent",
291810
- "paste",
291811
- "pointer",
291812
- "composition"
291813
- ];
291814
291813
  const notAllowedMeta = [
291815
291814
  "historyUndo",
291816
291815
  "historyRedo",
@@ -291819,13 +291818,7 @@ var Node$13 = class Node$14 {
291819
291818
  const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
291820
291819
  const ySyncMeta = tr.getMeta(ySyncPluginKey);
291821
291820
  const pendingDeadKeyPlaceholder = TrackChangesBasePluginKey.getState(state)?.pendingDeadKeyPlaceholder ?? null;
291822
- const allowedMeta = new Set([
291823
- ...onlyInputTypeMeta,
291824
- ySyncPluginKey.key,
291825
- "forceTrackChanges",
291826
- "protectTrackedReviewState"
291827
- ]);
291828
- const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta2) => !allowedMeta.has(meta2));
291821
+ const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta2) => !ALLOWED_META_KEYS.has(meta2));
291829
291822
  if (ySyncMeta?.isChangeOrigin || !tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
291830
291823
  if (pendingDeadKeyPlaceholder && !isCompositionTransaction(tr))
291831
291824
  mergeTrackChangesMeta(tr, { pendingDeadKeyPlaceholder: null });
@@ -291900,14 +291893,7 @@ var Node$13 = class Node$14 {
291900
291893
  else
291901
291894
  newTr.step(step3);
291902
291895
  });
291903
- if (tr.getMeta("inputType"))
291904
- newTr.setMeta("inputType", tr.getMeta("inputType"));
291905
- if (tr.getMeta("uiEvent"))
291906
- newTr.setMeta("uiEvent", tr.getMeta("uiEvent"));
291907
- if (tr.getMeta("composition") !== undefined)
291908
- newTr.setMeta("composition", tr.getMeta("composition"));
291909
- if (tr.getMeta("addToHistory") !== undefined)
291910
- newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
291896
+ copyPassthroughMeta(tr, newTr);
291911
291897
  mergeTrackChangesMeta(newTr, { pendingDeadKeyPlaceholder: getPendingDeadKeyPlaceholder({
291912
291898
  tr,
291913
291899
  newTr,
@@ -318943,7 +318929,7 @@ menclose::after {
318943
318929
  return;
318944
318930
  console.log(...args$1);
318945
318931
  }, 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, TRACKED_MARK_NAMES;
318946
- var init_src_DQ_lu_9z_es = __esm(() => {
318932
+ var init_src_Bm7Xq4ys_es = __esm(() => {
318947
318933
  init_rolldown_runtime_Bg48TavK_es();
318948
318934
  init_SuperConverter_C6hKp29w_es();
318949
318935
  init_jszip_C49i9kUs_es();
@@ -335934,6 +335920,26 @@ function print() { __p += __j.call(arguments, '') }
335934
335920
  ["~", "̃"],
335935
335921
  ["¨", "̈"]
335936
335922
  ]);
335923
+ TRACKABLE_META_KEYS = [
335924
+ "inputType",
335925
+ "uiEvent",
335926
+ "paste",
335927
+ "pointer",
335928
+ "composition",
335929
+ "superdocSlicePaste",
335930
+ "forceTrackChanges",
335931
+ "protectTrackedReviewState"
335932
+ ];
335933
+ PASSTHROUGH_META_KEYS = [
335934
+ "inputType",
335935
+ "uiEvent",
335936
+ "paste",
335937
+ "pointer",
335938
+ "composition",
335939
+ "addToHistory",
335940
+ "superdocSlicePaste"
335941
+ ];
335942
+ ALLOWED_META_KEYS = new Set([...TRACKABLE_META_KEYS, ySyncPluginKey.key]);
335937
335943
  TrackFormat = Mark3.create({
335938
335944
  name: TrackFormatMarkName,
335939
335945
  group: "track",
@@ -337212,8 +337218,13 @@ function print() { __p += __j.call(arguments, '') }
337212
337218
  if (dispatch)
337213
337219
  dispatch(tr);
337214
337220
  const presentationEditor = editor.presentationEditor;
337215
- if (!(presentationEditor?.scrollToPosition?.(from$1, { block: "center" }) ?? false)) {
337216
- Promise.resolve(presentationEditor?.scrollToPositionAsync?.(from$1, { block: "center" })).catch(() => {});
337221
+ const scrollOpts = {
337222
+ block: "center",
337223
+ ifNeeded: true,
337224
+ suppressSelectionSyncScroll: true
337225
+ };
337226
+ if (!(presentationEditor?.scrollToPosition?.(from$1, scrollOpts) ?? false)) {
337227
+ Promise.resolve(presentationEditor?.scrollToPositionAsync?.(from$1, scrollOpts)).catch(() => {});
337217
337228
  const { node: node3 } = editor.view.domAtPos(from$1);
337218
337229
  if (node3?.scrollIntoView)
337219
337230
  node3.scrollIntoView({
@@ -347073,6 +347084,7 @@ function print() { __p += __j.call(arguments, '') }
347073
347084
  #isRerendering = false;
347074
347085
  #selectionSync = new SelectionSyncCoordinator;
347075
347086
  #shouldScrollSelectionIntoView = false;
347087
+ #suppressSelectionScrollUntilRaf = false;
347076
347088
  #dragDropIndicatorPos = null;
347077
347089
  #epochMapper = new EpochPositionMapper;
347078
347090
  #layoutEpoch = 0;
@@ -348745,6 +348757,19 @@ function print() { __p += __j.call(arguments, '') }
348745
348757
  }
348746
348758
  return null;
348747
348759
  }
348760
+ #isElementFullyVisibleInScrollContainer(el) {
348761
+ const rect = el.getBoundingClientRect();
348762
+ const viewport$1 = this.#scrollContainer instanceof Window ? {
348763
+ top: 0,
348764
+ bottom: this.#scrollContainer.innerHeight
348765
+ } : this.#scrollContainer instanceof Element ? this.#scrollContainer.getBoundingClientRect() : this.#visibleHost?.ownerDocument?.defaultView ? {
348766
+ top: 0,
348767
+ bottom: this.#visibleHost.ownerDocument.defaultView.innerHeight
348768
+ } : null;
348769
+ if (!viewport$1)
348770
+ return false;
348771
+ return rect.top >= viewport$1.top && rect.bottom <= viewport$1.bottom;
348772
+ }
348748
348773
  scrollToPosition(pos, options = {}) {
348749
348774
  if (this.#focusScrollRafId != null) {
348750
348775
  const win = this.#visibleHost.ownerDocument?.defaultView;
@@ -348759,7 +348784,7 @@ function print() { __p += __j.call(arguments, '') }
348759
348784
  return false;
348760
348785
  const clampedPos = Math.max(0, Math.min(pos, doc$12.content.size));
348761
348786
  const behavior = options.behavior ?? "auto";
348762
- const block = options.block ?? "center";
348787
+ const requestedBlock = options.block ?? "center";
348763
348788
  const layout = this.#layoutState.layout;
348764
348789
  const sessionMode = this.#headerFooterSession?.session?.mode ?? "body";
348765
348790
  if (layout && sessionMode === "body") {
@@ -348779,7 +348804,9 @@ function print() { __p += __j.call(arguments, '') }
348779
348804
  if (pageIndex != null) {
348780
348805
  const pageEl = getPageElementByIndex(this.#viewportHost, pageIndex);
348781
348806
  if (pageEl) {
348782
- const elToScroll = this.#findElementAtPosition(pageEl, clampedPos) ?? pageEl;
348807
+ const targetEl = this.#findElementAtPosition(pageEl, clampedPos);
348808
+ const elToScroll = targetEl ?? pageEl;
348809
+ const block = options.ifNeeded && targetEl && this.#isElementFullyVisibleInScrollContainer(targetEl) ? "nearest" : requestedBlock;
348783
348810
  elToScroll.scrollIntoView({
348784
348811
  block,
348785
348812
  inline: "nearest",
@@ -348787,7 +348814,9 @@ function print() { __p += __j.call(arguments, '') }
348787
348814
  });
348788
348815
  this.#shouldScrollSelectionIntoView = false;
348789
348816
  const win = this.#visibleHost.ownerDocument?.defaultView;
348790
- if (win)
348817
+ if (win) {
348818
+ if (options.suppressSelectionSyncScroll)
348819
+ this.#suppressSelectionScrollUntilRaf = true;
348791
348820
  win.requestAnimationFrame(() => {
348792
348821
  elToScroll.scrollIntoView({
348793
348822
  block,
@@ -348795,7 +348824,9 @@ function print() { __p += __j.call(arguments, '') }
348795
348824
  behavior
348796
348825
  });
348797
348826
  this.#shouldScrollSelectionIntoView = false;
348827
+ this.#suppressSelectionScrollUntilRaf = false;
348798
348828
  });
348829
+ }
348799
348830
  return true;
348800
348831
  }
348801
348832
  }
@@ -348929,12 +348960,24 @@ function print() { __p += __j.call(arguments, '') }
348929
348960
  console.warn(`[PresentationEditor] scrollToPositionAsync: Page ${pageIndex} failed to mount within timeout`);
348930
348961
  return false;
348931
348962
  }
348932
- return this.scrollToPosition(pos, options);
348963
+ return this.scrollToPosition(pos, {
348964
+ ...options,
348965
+ ifNeeded: false
348966
+ });
348933
348967
  }
348934
348968
  async scrollContentControlIntoView(entityId, options = {}) {
348969
+ const pos = this.#resolveContentControlCaretPos(entityId);
348970
+ if (pos == null)
348971
+ return false;
348972
+ return this.scrollToPositionAsync(pos, {
348973
+ behavior: options.behavior ?? "smooth",
348974
+ block: options.block ?? "center"
348975
+ });
348976
+ }
348977
+ #resolveContentControlCaretPos(entityId) {
348935
348978
  const editor = this.#editor;
348936
348979
  if (!editor || typeof entityId !== "string" || entityId.length === 0)
348937
- return false;
348980
+ return null;
348938
348981
  let found2 = null;
348939
348982
  editor.state.doc.descendants((node3, pos) => {
348940
348983
  if (found2)
@@ -348950,7 +348993,7 @@ function print() { __p += __j.call(arguments, '') }
348950
348993
  return true;
348951
348994
  });
348952
348995
  if (!found2)
348953
- return false;
348996
+ return null;
348954
348997
  let contentPos = found2.pos + 1;
348955
348998
  let textFound = false;
348956
348999
  found2.node?.descendants((child, rel) => {
@@ -348963,10 +349006,48 @@ function print() { __p += __j.call(arguments, '') }
348963
349006
  }
348964
349007
  return true;
348965
349008
  });
348966
- return this.scrollToPositionAsync(contentPos, {
349009
+ return contentPos;
349010
+ }
349011
+ async focusContentControl(entityId, options = {}) {
349012
+ const editor = this.#editor;
349013
+ if (!editor)
349014
+ return {
349015
+ success: false,
349016
+ reason: "not-ready"
349017
+ };
349018
+ if (typeof entityId !== "string" || entityId.length === 0)
349019
+ return {
349020
+ success: false,
349021
+ reason: "invalid-id"
349022
+ };
349023
+ const pos = this.#resolveContentControlCaretPos(entityId);
349024
+ if (pos == null)
349025
+ return {
349026
+ success: false,
349027
+ reason: "not-found"
349028
+ };
349029
+ if (typeof editor.commands?.setTextSelection !== "function")
349030
+ return {
349031
+ success: false,
349032
+ reason: "not-ready"
349033
+ };
349034
+ if (!await this.scrollToPositionAsync(pos, {
348967
349035
  behavior: options.behavior ?? "smooth",
348968
349036
  block: options.block ?? "center"
348969
- });
349037
+ }))
349038
+ return {
349039
+ success: false,
349040
+ reason: "not-reachable"
349041
+ };
349042
+ if (!editor.commands.setTextSelection({
349043
+ from: pos,
349044
+ to: pos
349045
+ }))
349046
+ return {
349047
+ success: false,
349048
+ reason: "not-reachable"
349049
+ };
349050
+ return { success: true };
348970
349051
  }
348971
349052
  async scrollToPage(pageNumber, scrollBehavior = "smooth") {
348972
349053
  const layout = this.#layoutState.layout;
@@ -351156,6 +351237,8 @@ function print() { __p += __j.call(arguments, '') }
351156
351237
  }
351157
351238
  }
351158
351239
  #scrollActiveEndIntoView(pageIndex) {
351240
+ if (this.#suppressSelectionScrollUntilRaf)
351241
+ return;
351159
351242
  if (!!!this.#painterHost.querySelector(`[data-page-index="${pageIndex}"]`)) {
351160
351243
  this.#scrollPageIntoView(pageIndex);
351161
351244
  return;
@@ -353282,9 +353365,9 @@ function print() { __p += __j.call(arguments, '') }
353282
353365
  ]);
353283
353366
  });
353284
353367
 
353285
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-VNl09TSQ.es.js
353368
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DKJYU_qM.es.js
353286
353369
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
353287
- var init_create_super_doc_ui_VNl09TSQ_es = __esm(() => {
353370
+ var init_create_super_doc_ui_DKJYU_qM_es = __esm(() => {
353288
353371
  init_SuperConverter_C6hKp29w_es();
353289
353372
  init_create_headless_toolbar_ISx0N5AS_es();
353290
353373
  MOD_ALIASES = new Set([
@@ -353328,7 +353411,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
353328
353411
 
353329
353412
  // ../../packages/superdoc/dist/super-editor.es.js
353330
353413
  var init_super_editor_es = __esm(() => {
353331
- init_src_DQ_lu_9z_es();
353414
+ init_src_Bm7Xq4ys_es();
353332
353415
  init_SuperConverter_C6hKp29w_es();
353333
353416
  init_jszip_C49i9kUs_es();
353334
353417
  init_xml_js_CqGKpaft_es();
@@ -353337,7 +353420,7 @@ var init_super_editor_es = __esm(() => {
353337
353420
  init_dist_B8HfvhaK_es();
353338
353421
  init_unified_Dsuw2be5_es();
353339
353422
  init_DocxZipper_nv_KfOqb_es();
353340
- init_create_super_doc_ui_VNl09TSQ_es();
353423
+ init_create_super_doc_ui_DKJYU_qM_es();
353341
353424
  init_ui_C5PAS9hY_es();
353342
353425
  init_eventemitter3_BnGqBE_Q_es();
353343
353426
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.15.0-next.9",
3
+ "version": "0.15.0",
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
27
  "@superdoc/super-editor": "0.0.1",
29
28
  "superdoc": "1.37.0",
30
- "@superdoc/pm-adapter": "0.0.0"
29
+ "@superdoc/pm-adapter": "0.0.0",
30
+ "@superdoc/document-api": "0.0.1"
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.15.0-next.9",
38
- "@superdoc-dev/cli-darwin-x64": "0.15.0-next.9",
39
- "@superdoc-dev/cli-linux-x64": "0.15.0-next.9",
40
- "@superdoc-dev/cli-linux-arm64": "0.15.0-next.9",
41
- "@superdoc-dev/cli-windows-x64": "0.15.0-next.9"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.15.0",
38
+ "@superdoc-dev/cli-darwin-x64": "0.15.0",
39
+ "@superdoc-dev/cli-linux-x64": "0.15.0",
40
+ "@superdoc-dev/cli-linux-arm64": "0.15.0",
41
+ "@superdoc-dev/cli-windows-x64": "0.15.0"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",