@superdoc-dev/cli 0.2.0-next.36 → 0.2.0-next.37

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 +64 -31
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -101805,9 +101805,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
101805
101805
  init_remark_gfm_z_sDF4ss_es();
101806
101806
  });
101807
101807
 
101808
- // ../../packages/superdoc/dist/chunks/src-De1yZkuR.es.js
101809
- var exports_src_De1yZkuR_es = {};
101810
- __export(exports_src_De1yZkuR_es, {
101808
+ // ../../packages/superdoc/dist/chunks/src-D9teEfgS.es.js
101809
+ var exports_src_D9teEfgS_es = {};
101810
+ __export(exports_src_D9teEfgS_es, {
101811
101811
  zt: () => defineMark,
101812
101812
  z: () => cM,
101813
101813
  yt: () => removeAwarenessStates,
@@ -129160,7 +129160,8 @@ function computeSelectionRectsFromDom(options, from$12, to) {
129160
129160
  const sliceTo = Math.min(end$1, pagePmEnd);
129161
129161
  if (sliceFrom >= sliceTo)
129162
129162
  continue;
129163
- let sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo);
129163
+ const rangeOpts = { boundaryInclusive: true };
129164
+ let sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo, rangeOpts);
129164
129165
  if (sliceEntries.length === 0)
129165
129166
  continue;
129166
129167
  const filterPageEntries = (entries) => entries.filter((entry) => pageEl.contains(entry.el));
@@ -129168,7 +129169,7 @@ function computeSelectionRectsFromDom(options, from$12, to) {
129168
129169
  if (pageEntries.length === 0 && !rebuiltOnce) {
129169
129170
  options.rebuildDomPositionIndex();
129170
129171
  rebuiltOnce = true;
129171
- sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo);
129172
+ sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo, rangeOpts);
129172
129173
  pageEntries = filterPageEntries(sliceEntries);
129173
129174
  }
129174
129175
  if (pageEntries.length === 0)
@@ -129192,7 +129193,7 @@ function computeSelectionRectsFromDom(options, from$12, to) {
129192
129193
  if ((!startEntry?.el?.isConnected || !endEntry?.el?.isConnected) && !rebuiltOnce) {
129193
129194
  options.rebuildDomPositionIndex();
129194
129195
  rebuiltOnce = true;
129195
- sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo);
129196
+ sliceEntries = options.domPositionIndex.findEntriesInRange(sliceFrom, sliceTo, rangeOpts);
129196
129197
  pageEntries = filterPageEntries(sliceEntries);
129197
129198
  if (pageEntries.length === 0)
129198
129199
  continue;
@@ -134677,7 +134678,7 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
134677
134678
  }
134678
134679
  logClickStage("log", "geometry-attempt", { trying: "geometry-based mapping" });
134679
134680
  let pageHit = null;
134680
- let isContainerPointPageRelative = false;
134681
+ let domPageRelativeY;
134681
134682
  if (domContainer != null && clientX != null && clientY != null) {
134682
134683
  const pageEl = findPageElement(domContainer, clientX, clientY);
134683
134684
  if (pageEl) {
@@ -134687,7 +134688,11 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
134687
134688
  pageIndex: domPageIndex,
134688
134689
  page: layout.pages[domPageIndex]
134689
134690
  };
134690
- isContainerPointPageRelative = true;
134691
+ const pageRect = pageEl.getBoundingClientRect();
134692
+ const layoutPageHeight = pageHit.page.size?.h ?? layout.pageSize.h;
134693
+ const domPageHeight = pageRect.height;
134694
+ const effectiveZoom = domPageHeight > 0 && layoutPageHeight > 0 ? domPageHeight / layoutPageHeight : 1;
134695
+ domPageRelativeY = (clientY - pageRect.top) / effectiveZoom;
134691
134696
  }
134692
134697
  }
134693
134698
  }
@@ -134697,16 +134702,11 @@ function clickToPosition(layout, blocks2, measures, containerPoint, domContainer
134697
134702
  logClickStage("warn", "no-page", { point: containerPoint });
134698
134703
  return null;
134699
134704
  }
134700
- let pageRelativePoint;
134701
- if (isContainerPointPageRelative)
134702
- pageRelativePoint = containerPoint;
134703
- else {
134704
- const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
134705
- pageRelativePoint = {
134706
- x: containerPoint.x,
134707
- y: containerPoint.y - pageTopY
134708
- };
134709
- }
134705
+ const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
134706
+ const pageRelativePoint = {
134707
+ x: containerPoint.x,
134708
+ y: domPageRelativeY ?? containerPoint.y - pageTopY
134709
+ };
134710
134710
  logClickStage("log", "page-hit", {
134711
134711
  pageIndex: pageHit.pageIndex,
134712
134712
  pageRelativePoint
@@ -159810,7 +159810,7 @@ var Node$13 = class Node$14 {
159810
159810
  findElementAtPosition(pos) {
159811
159811
  return this.findEntryAtPosition(pos)?.el ?? null;
159812
159812
  }
159813
- findEntriesInRange(from$12, to) {
159813
+ findEntriesInRange(from$12, to, options) {
159814
159814
  if (!Number.isFinite(from$12) || !Number.isFinite(to))
159815
159815
  return [];
159816
159816
  const start$1 = Math.min(from$12, to);
@@ -159820,6 +159820,7 @@ var Node$13 = class Node$14 {
159820
159820
  const entries = this.#entries;
159821
159821
  if (entries.length === 0)
159822
159822
  return [];
159823
+ const inclusive = options?.boundaryInclusive === true;
159823
159824
  let lo = 0;
159824
159825
  let hi = entries.length;
159825
159826
  while (lo < hi) {
@@ -159835,9 +159836,9 @@ var Node$13 = class Node$14 {
159835
159836
  const out = [];
159836
159837
  for (let i$1 = idx;i$1 < entries.length; i$1 += 1) {
159837
159838
  const entry = entries[i$1];
159838
- if (entry.pmStart >= end$1)
159839
+ if (inclusive ? entry.pmStart > end$1 : entry.pmStart >= end$1)
159839
159840
  break;
159840
- if (entry.pmEnd <= start$1)
159841
+ if (inclusive ? entry.pmEnd < start$1 : entry.pmEnd <= start$1)
159841
159842
  continue;
159842
159843
  out.push(entry);
159843
159844
  }
@@ -164563,6 +164564,26 @@ var Node$13 = class Node$14 {
164563
164564
  const layoutState = this.#deps?.getLayoutState();
164564
164565
  return calculateExtendedSelection(layoutState?.blocks ?? [], anchor, head, mode);
164565
164566
  }
164567
+ #clampHeadAtIsolatingBoundary(doc$2, anchor, head) {
164568
+ const forward = head >= anchor;
164569
+ try {
164570
+ const $head = doc$2.resolve(head);
164571
+ let isolatingDepth = -1;
164572
+ for (let d = $head.depth;d > 0; d--) {
164573
+ const node3 = $head.node(d);
164574
+ if (node3.type.spec.isolating || node3.type.spec.tableRole === "table")
164575
+ isolatingDepth = d;
164576
+ }
164577
+ if (isolatingDepth > 0) {
164578
+ const boundary = forward ? $head.before(isolatingDepth) : $head.after(isolatingDepth);
164579
+ const near = Selection.near(doc$2.resolve(boundary), forward ? -1 : 1);
164580
+ if (near instanceof TextSelection2)
164581
+ return near.head;
164582
+ return anchor;
164583
+ }
164584
+ } catch {}
164585
+ return head;
164586
+ }
164566
164587
  #shouldUseCellSelection(currentTableHit) {
164567
164588
  return shouldUseCellSelection(currentTableHit, this.#cellAnchor, this.#cellDragMode);
164568
164589
  }
@@ -164948,8 +164969,11 @@ var Node$13 = class Node$14 {
164948
164969
  const tableHit = this.#hitTestTable(x, y$1);
164949
164970
  if (tableHit) {
164950
164971
  const tablePos = this.#getTablePosFromHit(tableHit);
164951
- if (tablePos !== null)
164972
+ const hitIsInsideTable = tablePos !== null && doc$2 && hit.pos >= tablePos && hit.pos <= tablePos + (doc$2.nodeAt(tablePos)?.nodeSize ?? 0);
164973
+ if (tablePos !== null && hitIsInsideTable)
164952
164974
  this.#setCellAnchor(tableHit, tablePos);
164975
+ else
164976
+ this.#clearCellAnchor();
164953
164977
  } else
164954
164978
  this.#clearCellAnchor();
164955
164979
  } else
@@ -165496,7 +165520,9 @@ var Node$13 = class Node$14 {
165496
165520
  return;
165497
165521
  }
165498
165522
  const anchor = this.#dragAnchor;
165499
- const head = hit.pos;
165523
+ let head = hit.pos;
165524
+ if (!this.#cellAnchor)
165525
+ head = this.#clampHeadAtIsolatingBoundary(doc$2, anchor, head);
165500
165526
  const { selAnchor, selHead } = this.#calculateExtendedSelection(anchor, head, this.#dragExtensionMode);
165501
165527
  try {
165502
165528
  const tr = editor.state.tr.setSelection(TextSelection2.create(editor.state.doc, selAnchor, selHead));
@@ -173370,7 +173396,7 @@ var Node$13 = class Node$14 {
173370
173396
  trackedChanges: context.trackedChanges ?? []
173371
173397
  });
173372
173398
  }, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
173373
- var init_src_De1yZkuR_es = __esm(() => {
173399
+ var init_src_D9teEfgS_es = __esm(() => {
173374
173400
  init_rolldown_runtime_B2q5OVn9_es();
173375
173401
  init_SuperConverter_BSZgN87C_es();
173376
173402
  init_jszip_ChlR43oI_es();
@@ -193771,6 +193797,13 @@ function print() { __p += __j.call(arguments, '') }
193771
193797
  });
193772
193798
  return;
193773
193799
  }
193800
+ if (domRects.length === 0 && from$12 !== to && this.#editorInputManager?.isDragging) {
193801
+ debugLog("warn", "[drawSelection] zero rects for non-collapsed selection — preserving last overlay", {
193802
+ from: from$12,
193803
+ to
193804
+ });
193805
+ return;
193806
+ }
193774
193807
  try {
193775
193808
  this.#localSelectionLayer.innerHTML = "";
193776
193809
  const isFieldAnnotationSelection = selection instanceof NodeSelection && selection.node?.type?.name === "fieldAnnotation";
@@ -204263,8 +204296,8 @@ function print() { __p += __j.call(arguments, '') }
204263
204296
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
204264
204297
  };
204265
204298
  stubFalse_default = stubFalse;
204266
- freeExports$2 = typeof exports_src_De1yZkuR_es == "object" && exports_src_De1yZkuR_es && !exports_src_De1yZkuR_es.nodeType && exports_src_De1yZkuR_es;
204267
- freeModule$2 = freeExports$2 && typeof module_src_De1yZkuR_es == "object" && module_src_De1yZkuR_es && !module_src_De1yZkuR_es.nodeType && module_src_De1yZkuR_es;
204299
+ freeExports$2 = typeof exports_src_D9teEfgS_es == "object" && exports_src_D9teEfgS_es && !exports_src_D9teEfgS_es.nodeType && exports_src_D9teEfgS_es;
204300
+ freeModule$2 = freeExports$2 && typeof module_src_D9teEfgS_es == "object" && module_src_D9teEfgS_es && !module_src_D9teEfgS_es.nodeType && module_src_D9teEfgS_es;
204268
204301
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
204269
204302
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
204270
204303
  typedArrayTags = {};
@@ -204272,8 +204305,8 @@ function print() { __p += __j.call(arguments, '') }
204272
204305
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
204273
204306
  _baseIsTypedArray_default = baseIsTypedArray;
204274
204307
  _baseUnary_default = baseUnary;
204275
- freeExports$1 = typeof exports_src_De1yZkuR_es == "object" && exports_src_De1yZkuR_es && !exports_src_De1yZkuR_es.nodeType && exports_src_De1yZkuR_es;
204276
- freeModule$1 = freeExports$1 && typeof module_src_De1yZkuR_es == "object" && module_src_De1yZkuR_es && !module_src_De1yZkuR_es.nodeType && module_src_De1yZkuR_es;
204308
+ freeExports$1 = typeof exports_src_D9teEfgS_es == "object" && exports_src_D9teEfgS_es && !exports_src_D9teEfgS_es.nodeType && exports_src_D9teEfgS_es;
204309
+ freeModule$1 = freeExports$1 && typeof module_src_D9teEfgS_es == "object" && module_src_D9teEfgS_es && !module_src_D9teEfgS_es.nodeType && module_src_D9teEfgS_es;
204277
204310
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
204278
204311
  _nodeUtil_default = function() {
204279
204312
  try {
@@ -204378,8 +204411,8 @@ function print() { __p += __j.call(arguments, '') }
204378
204411
  Stack.prototype.has = _stackHas_default;
204379
204412
  Stack.prototype.set = _stackSet_default;
204380
204413
  _Stack_default = Stack;
204381
- freeExports = typeof exports_src_De1yZkuR_es == "object" && exports_src_De1yZkuR_es && !exports_src_De1yZkuR_es.nodeType && exports_src_De1yZkuR_es;
204382
- freeModule = freeExports && typeof module_src_De1yZkuR_es == "object" && module_src_De1yZkuR_es && !module_src_De1yZkuR_es.nodeType && module_src_De1yZkuR_es;
204414
+ freeExports = typeof exports_src_D9teEfgS_es == "object" && exports_src_D9teEfgS_es && !exports_src_D9teEfgS_es.nodeType && exports_src_D9teEfgS_es;
204415
+ freeModule = freeExports && typeof module_src_D9teEfgS_es == "object" && module_src_D9teEfgS_es && !module_src_D9teEfgS_es.nodeType && module_src_D9teEfgS_es;
204383
204416
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
204384
204417
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
204385
204418
  _cloneBuffer_default = cloneBuffer;
@@ -212031,7 +212064,7 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
212031
212064
 
212032
212065
  // ../../packages/superdoc/dist/super-editor.es.js
212033
212066
  var init_super_editor_es = __esm(() => {
212034
- init_src_De1yZkuR_es();
212067
+ init_src_D9teEfgS_es();
212035
212068
  init_SuperConverter_BSZgN87C_es();
212036
212069
  init_jszip_ChlR43oI_es();
212037
212070
  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.36",
3
+ "version": "0.2.0-next.37",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -19,9 +19,9 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
- "@superdoc/document-api": "0.0.1",
23
22
  "@superdoc/pm-adapter": "0.0.0",
24
23
  "@superdoc/super-editor": "0.0.1",
24
+ "@superdoc/document-api": "0.0.1",
25
25
  "superdoc": "1.16.0"
26
26
  },
27
27
  "module": "src/index.ts",
@@ -29,11 +29,11 @@
29
29
  "access": "public"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.36",
33
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.36",
34
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.36",
35
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.36",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.36"
32
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.37",
33
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.37",
34
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.37",
35
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.37",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.37"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "bun run src/index.ts",