superdoc 2.22.0 → 2.22.1-next.2

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.
@@ -314,7 +314,7 @@ var shuffleArray = (array) => {
314
314
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
315
315
  function getSuperdocVersion() {
316
316
  try {
317
- return "2.22.0";
317
+ return "2.22.1-next.2";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -13623,7 +13623,6 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13623
13623
  const isTrackedChange = Boolean(props.comment?.trackedChange);
13624
13624
  const targetClientY = getPreferredCommentFocusTargetClientY();
13625
13625
  const isInstanceScopedDialog = props.floatingInstanceId != null;
13626
- const currentDialogTop = commentDialogElement.value?.getBoundingClientRect?.().top;
13627
13626
  const willChangeActiveDialog = !props.comment.resolvedTime && (activeComment.value !== props.comment.commentId || isInstanceScopedDialog && currentFloatingInstanceId.value !== activeFloatingCommentInstanceId.value);
13628
13627
  let instantAlignmentTargetY = targetClientY;
13629
13628
  if (v2Adapter) {
@@ -13642,8 +13641,13 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13642
13641
  if (props.floatingInstanceId) setActiveFloatingCommentInstance(props.floatingInstanceId);
13643
13642
  }
13644
13643
  if (willChangeActiveDialog && !isInstanceScopedDialog) requestInstantSidebarAlignment(targetClientY, props.comment.commentId, props.floatingInstanceId ?? null);
13645
- else if (willChangeActiveDialog && Number.isFinite(currentDialogTop)) requestInstantSidebarAlignment(currentDialogTop, props.comment.commentId, props.floatingInstanceId);
13646
- else clearInstantSidebarAlignment();
13644
+ else if (isInstanceScopedDialog && !props.comment.resolvedTime) {
13645
+ await nextTick();
13646
+ const { entry } = resolveCommentPositionEntry(props.comment);
13647
+ const anchorClientY = getVisibleThreadAnchorClientY(props.parent, props.floatingPositionEntry ?? entry);
13648
+ if (Number.isFinite(anchorClientY)) requestInstantSidebarAlignment(anchorClientY, props.comment.commentId, props.floatingInstanceId);
13649
+ else clearInstantSidebarAlignment();
13650
+ } else clearInstantSidebarAlignment();
13647
13651
  return result;
13648
13652
  }
13649
13653
  if (editor) {
@@ -14335,7 +14339,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14335
14339
  ], 64))], 14, _hoisted_1$27)), [[_directive_click_outside, handleClickOutside]]);
14336
14340
  };
14337
14341
  }
14338
- }, [["__scopeId", "data-v-eefd4750"]]);
14342
+ }, [["__scopeId", "data-v-21ad0f69"]]);
14339
14343
  //#endregion
14340
14344
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
14341
14345
  var _hoisted_1$26 = [
@@ -15059,9 +15063,6 @@ var composeAuthorColorResolver = (config) => {
15059
15063
  };
15060
15064
  //#endregion
15061
15065
  //#region src/components/CommentsLayer/floating-comment-positioning.js
15062
- var isPersistentReviewSidebarItem = (comment) => {
15063
- return Boolean(comment?.trackedChange);
15064
- };
15065
15066
  var normalizeFloatingAnchorTop = (top) => {
15066
15067
  return top;
15067
15068
  };
@@ -15069,12 +15070,11 @@ var isAnchorOutsideFloatingViewport = (anchorTop, viewportTop, viewportBottom, a
15069
15070
  if (!Number.isFinite(anchorTop) || !Number.isFinite(viewportTop) || !Number.isFinite(viewportBottom)) return false;
15070
15071
  return (Number.isFinite(anchorBottom) ? anchorBottom : anchorTop) < viewportTop || anchorTop > viewportBottom;
15071
15072
  };
15072
- var shouldKeepPersistentReviewCardAtAnchor = ({ comment, anchorTop, anchorBottom, viewportTop, viewportBottom }) => {
15073
- return isPersistentReviewSidebarItem(comment) && isAnchorOutsideFloatingViewport(anchorTop, viewportTop, viewportBottom, anchorBottom);
15073
+ var shouldKeepFloatingCardAtAnchor = ({ anchorTop, anchorBottom, viewportTop, viewportBottom }) => {
15074
+ return isAnchorOutsideFloatingViewport(anchorTop, viewportTop, viewportBottom, anchorBottom);
15074
15075
  };
15075
- var resolvePersistentReviewCardTop = ({ comment, anchorTop, anchorBottom, cardHeight, viewportTop, viewportBottom }) => {
15076
- if (!shouldKeepPersistentReviewCardAtAnchor({
15077
- comment,
15076
+ var resolveOffscreenFloatingCardTop = ({ anchorTop, anchorBottom, cardHeight, viewportTop, viewportBottom }) => {
15077
+ if (!shouldKeepFloatingCardAtAnchor({
15078
15078
  anchorTop,
15079
15079
  anchorBottom,
15080
15080
  viewportTop,
@@ -15159,11 +15159,6 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15159
15159
  positions[i].top = Math.min(positions[i].anchorTop, bottomEdge);
15160
15160
  cursor = positions[i].top - gap;
15161
15161
  }
15162
- const minTop = Math.min(...positions.map((p) => p.top));
15163
- if (minTop < 0) {
15164
- const shift = Math.abs(minTop);
15165
- for (const p of positions) p.top += shift;
15166
- }
15167
15162
  } else for (let i = 1; i < positions.length; i++) {
15168
15163
  const prev = positions[i - 1];
15169
15164
  const minTop = prev.top + prev.height + gap;
@@ -15421,8 +15416,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15421
15416
  positions.sort((a, b) => a.anchorTop - b.anchorTop);
15422
15417
  const collisionPositions = [];
15423
15418
  for (const position of positions) {
15424
- const offscreenTop = position.hasAnchorGeometry ? resolvePersistentReviewCardTop({
15425
- comment: position.commentRef,
15419
+ const offscreenTop = position.hasAnchorGeometry ? resolveOffscreenFloatingCardTop({
15426
15420
  anchorTop: position.anchorTop,
15427
15421
  anchorBottom: position.anchorBottom,
15428
15422
  cardHeight: position.height,
@@ -15633,6 +15627,9 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15633
15627
  releaseDecisionContinuityForOwnerScroll();
15634
15628
  refreshViewportWindow();
15635
15629
  };
15630
+ const handleDocumentScroll = (event) => {
15631
+ if (event.target instanceof Element && event.target.matches(".superdoc__sub-document")) handleOwnerScroll();
15632
+ };
15636
15633
  const registerOwnerScrollListeners = () => {
15637
15634
  const addTarget = (target) => {
15638
15635
  if (!target?.addEventListener || ownerScrollTargets.has(target)) return;
@@ -15640,10 +15637,15 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15640
15637
  ownerScrollTargets.add(target);
15641
15638
  };
15642
15639
  addTarget(props.parent);
15640
+ props.parent?.addEventListener?.("scroll", handleDocumentScroll, {
15641
+ passive: true,
15642
+ capture: true
15643
+ });
15643
15644
  for (let ancestor = floatingCommentsContainer.value?.parentElement; ancestor; ancestor = ancestor.parentElement) if (SCROLL_OWNER_OVERFLOW_VALUES.has(window.getComputedStyle(ancestor).overflowY)) addTarget(ancestor);
15644
15645
  addTarget(window);
15645
15646
  };
15646
15647
  const unregisterOwnerScrollListeners = () => {
15648
+ props.parent?.removeEventListener?.("scroll", handleDocumentScroll, true);
15647
15649
  for (const target of ownerScrollTargets) target.removeEventListener?.("scroll", handleOwnerScroll);
15648
15650
  ownerScrollTargets.clear();
15649
15651
  };
@@ -15806,14 +15808,16 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15806
15808
  }
15807
15809
  });
15808
15810
  let prevPositionIds = /* @__PURE__ */ new Set();
15811
+ let prevActiveInstanceId = null;
15809
15812
  let prevActiveAnchorTop = null;
15810
15813
  let prevActiveLayoutTop = null;
15811
15814
  watch$1(allPositions, (positions) => {
15812
15815
  const activePosition = activeCommentInstanceId.value ? positions.find((position) => position.id === activeCommentInstanceId.value) : null;
15813
15816
  const activeAnchorTop = typeof activePosition?.anchorTop === "number" && Number.isFinite(activePosition.anchorTop) ? activePosition.anchorTop : null;
15814
- const activeAnchorMoved = activeAnchorTop != null && prevActiveAnchorTop != null && Math.abs(activeAnchorTop - prevActiveAnchorTop) > 1;
15817
+ const sameActiveInstance = activeCommentInstanceId.value === prevActiveInstanceId;
15818
+ const activeAnchorMoved = sameActiveInstance && activeAnchorTop != null && prevActiveAnchorTop != null && Math.abs(activeAnchorTop - prevActiveAnchorTop) > 1;
15815
15819
  const activeLayoutTop = typeof activePosition?.top === "number" && Number.isFinite(activePosition.top) ? activePosition.top : null;
15816
- const activeLayoutMoved = activeLayoutTop != null && prevActiveLayoutTop != null && Math.abs(activeLayoutTop - prevActiveLayoutTop) > 1;
15820
+ const activeLayoutMoved = sameActiveInstance && activeLayoutTop != null && prevActiveLayoutTop != null && Math.abs(activeLayoutTop - prevActiveLayoutTop) > 1;
15817
15821
  if (activeAnchorMoved && sidebarOffsetY.value !== 0 && !Number.isFinite(instantSidebarAlignmentTargetY.value)) {
15818
15822
  sidebarOffsetY.value = 0;
15819
15823
  setInstantLayoutTransitionsDisabled(false);
@@ -15826,6 +15830,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15826
15830
  if (!sidebarContinuityAnchor && !Number.isFinite(instantSidebarAlignmentTargetY.value)) setInstantLayoutTransitionsDisabled(false);
15827
15831
  });
15828
15832
  }
15833
+ prevActiveInstanceId = activeCommentInstanceId.value;
15829
15834
  prevActiveAnchorTop = activeAnchorTop;
15830
15835
  prevActiveLayoutTop = activeLayoutTop;
15831
15836
  const positionOrder = positions.map((position) => position.id);
@@ -15985,7 +15990,7 @@ var FloatingComments_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
15985
15990
  }), 128))], 4)], 36);
15986
15991
  };
15987
15992
  }
15988
- }, [["__scopeId", "data-v-8262096d"]]);
15993
+ }, [["__scopeId", "data-v-15b59a51"]]);
15989
15994
  //#endregion
15990
15995
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue
15991
15996
  var _hoisted_1$23 = {
@@ -46311,7 +46316,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46311
46316
  this.config.colors = shuffleArray(this.config.colors);
46312
46317
  this.userColorMap = /* @__PURE__ */ new Map();
46313
46318
  this.colorIndex = 0;
46314
- this.version = "2.22.0";
46319
+ this.version = "2.22.1-next.2";
46315
46320
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46316
46321
  this.superdocId = config.superdocId || v4();
46317
46322
  this.colors = this.config.colors ?? [];