superdoc 2.0.0-next.37 → 2.0.0-next.39

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.
package/dist/superdoc.cjs CHANGED
@@ -6,7 +6,7 @@ const require_uuid = require("./chunks/uuid-CFp0WGVU.cjs");
6
6
  const require_jszip = require("./chunks/jszip-BdUBlUeG.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-BTwbGDKw.cjs");
8
8
  const require_constants = require("./chunks/constants-sbCZ2O_A.cjs");
9
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DLyJzmj9.cjs");
9
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-kkZK7Tc-.cjs");
10
10
  let vue = require("vue");
11
11
  vue = require_rolldown_runtime.__toESM(vue);
12
12
  require("y-websocket");
@@ -7766,7 +7766,7 @@ var _sfc_main$32 = {
7766
7766
  commentsStore.lastUpdate = /* @__PURE__ */ new Date();
7767
7767
  activeComment.value = null;
7768
7768
  commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
7769
- proxy.$superdoc.focus?.();
7769
+ proxy.$superdoc.focus?.({ preventScroll: true });
7770
7770
  });
7771
7771
  return;
7772
7772
  }
@@ -7826,7 +7826,7 @@ var _sfc_main$32 = {
7826
7826
  commentsStore.lastUpdate = /* @__PURE__ */ new Date();
7827
7827
  activeComment.value = null;
7828
7828
  commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
7829
- proxy.$superdoc.focus?.();
7829
+ proxy.$superdoc.focus?.({ preventScroll: true });
7830
7830
  });
7831
7831
  return;
7832
7832
  }
@@ -8213,7 +8213,7 @@ var _sfc_main$32 = {
8213
8213
  };
8214
8214
  }
8215
8215
  };
8216
- var CommentDialog_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$32, [["__scopeId", "data-v-74340036"]]);
8216
+ var CommentDialog_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$32, [["__scopeId", "data-v-387d6ba0"]]);
8217
8217
  var _hoisted_1$24 = { class: "comments-list" };
8218
8218
  var _hoisted_2$19 = { key: 0 };
8219
8219
  var _hoisted_3$15 = [
@@ -8643,6 +8643,7 @@ var _sfc_main$30 = {
8643
8643
  const commentsRenderKey = (0, vue.ref)(0);
8644
8644
  const sidebarOffsetY = (0, vue.ref)(0);
8645
8645
  const disableInstantLayoutTransitions = (0, vue.ref)(false);
8646
+ const directDecisionContinuityTargetId = (0, vue.ref)(null);
8646
8647
  const viewportRevision = (0, vue.ref)(0);
8647
8648
  const isPendingThread = (commentOrId) => {
8648
8649
  const pendingId = pendingComment.value?.commentId;
@@ -8937,6 +8938,7 @@ var _sfc_main$30 = {
8937
8938
  });
8938
8939
  };
8939
8940
  const setInstantLayoutTransitionsDisabled = (disabled) => {
8941
+ if (!disabled && directDecisionContinuityTargetId.value != null) return;
8940
8942
  disableInstantLayoutTransitions.value = disabled;
8941
8943
  };
8942
8944
  const alignCommentKeyToClientY = (key, targetY, onComplete) => {
@@ -8977,6 +8979,20 @@ var _sfc_main$30 = {
8977
8979
  let continuityAlignmentGeneration = 0;
8978
8980
  let continuityTransitionFrame = null;
8979
8981
  let activeLayoutContinuityFrame = null;
8982
+ let directDecisionContinuity = null;
8983
+ let directDecisionSourceId = null;
8984
+ const releaseDirectDecisionContinuity = () => {
8985
+ directDecisionContinuity = null;
8986
+ directDecisionSourceId = null;
8987
+ directDecisionContinuityTargetId.value = null;
8988
+ setInstantLayoutTransitionsDisabled(false);
8989
+ };
8990
+ const releaseDirectDecisionContinuityForUnrelatedPointer = (event) => {
8991
+ if (!directDecisionContinuity) return;
8992
+ const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
8993
+ const action = actionElement?.getAttribute?.("data-comment-action");
8994
+ if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement))) releaseDirectDecisionContinuity();
8995
+ };
8980
8996
  const clearDeferredRemeasureTimers = () => {
8981
8997
  remeasureTimers.forEach(clearTimeout);
8982
8998
  remeasureTimers = [];
@@ -9072,13 +9088,48 @@ var _sfc_main$30 = {
9072
9088
  scheduleSidebarContinuityAlignment();
9073
9089
  return true;
9074
9090
  };
9091
+ const prepareSidebarContinuityForDirectDecision = (event) => {
9092
+ const actionElement = event?.target?.closest?.("[data-comment-action]");
9093
+ const action = actionElement?.getAttribute?.("data-comment-action");
9094
+ if (action !== "resolve" && action !== "reject") return;
9095
+ releaseDirectDecisionContinuity();
9096
+ if (actionElement.getAttribute?.("aria-disabled") === "true") return;
9097
+ const removedKey = (actionElement.closest?.("[data-comment-id]"))?.getAttribute?.("data-comment-id");
9098
+ if (!removedKey || String(activeCommentInstanceId.value ?? "") === String(removedKey)) return;
9099
+ const previousIds = allPositions.value.filter((position) => position.commentRef?.trackedChange).map((position, index) => ({
9100
+ id: position.id,
9101
+ index,
9102
+ top: position.top
9103
+ })).filter((position) => Number.isFinite(position.top)).sort((left, right) => left.top - right.top || left.index - right.index).map((position) => position.id);
9104
+ const targetKey = resolveRemovedReviewCardContinuityTarget({
9105
+ previousIds,
9106
+ currentIds: new Set(previousIds),
9107
+ removedId: removedKey
9108
+ });
9109
+ const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
9110
+ if (!targetKey || !Number.isFinite(targetClientY)) return;
9111
+ directDecisionContinuity = {
9112
+ removedKey,
9113
+ targetKey,
9114
+ targetClientY,
9115
+ applied: false
9116
+ };
9117
+ directDecisionSourceId = removedKey;
9118
+ directDecisionContinuityTargetId.value = targetKey;
9119
+ setInstantLayoutTransitionsDisabled(true);
9120
+ };
9075
9121
  (0, vue.watch)(activeCommentInstanceId, (newKey, oldKey) => {
9076
9122
  clearDeferredRemeasureTimers();
9077
- if (newKey) clearSidebarContinuityAnchor();
9078
- else if (oldKey) {
9079
- const currentIds = new Set(allPositions.value.map((position) => position.id));
9080
- if (!currentIds.has(oldKey)) preserveSidebarContinuityAfterRemoval(oldKey, currentIds);
9081
- else clearSidebarContinuityAnchor();
9123
+ if (!(directDecisionContinuity != null && directDecisionSourceId != null && [newKey, oldKey].some((key) => key != null && String(key) === String(directDecisionSourceId)))) {
9124
+ directDecisionSourceId = null;
9125
+ if (newKey) {
9126
+ releaseDirectDecisionContinuity();
9127
+ clearSidebarContinuityAnchor();
9128
+ } else if (oldKey) {
9129
+ const currentIds = new Set(allPositions.value.map((position) => position.id));
9130
+ if (!currentIds.has(oldKey)) preserveSidebarContinuityAfterRemoval(oldKey, currentIds);
9131
+ else clearSidebarContinuityAnchor();
9132
+ }
9082
9133
  }
9083
9134
  const keysToRemeasure = [newKey, oldKey];
9084
9135
  const hasPendingInstantAlignment = newKey && newKey === instantAlignmentInstanceKey.value && Number.isFinite(instantSidebarAlignmentTargetY.value);
@@ -9171,6 +9222,19 @@ var _sfc_main$30 = {
9171
9222
  prevActiveLayoutTop = activeLayoutTop;
9172
9223
  const positionOrder = positions.map((position) => position.id);
9173
9224
  const currentIds = new Set(positionOrder);
9225
+ if (directDecisionContinuity && !directDecisionContinuity.applied && !currentIds.has(directDecisionContinuity.removedKey)) {
9226
+ const { targetKey, targetClientY } = directDecisionContinuity;
9227
+ directDecisionContinuity.applied = true;
9228
+ if (currentIds.has(targetKey) && Number.isFinite(targetClientY)) {
9229
+ sidebarContinuityAnchor = {
9230
+ key: targetKey,
9231
+ targetClientY
9232
+ };
9233
+ continuityAlignmentGeneration += 1;
9234
+ scheduleSidebarContinuityAlignment();
9235
+ } else releaseDirectDecisionContinuity();
9236
+ }
9237
+ if (directDecisionContinuity?.applied && !currentIds.has(directDecisionContinuity.targetKey)) releaseDirectDecisionContinuity();
9174
9238
  if (sidebarContinuityAnchor && !currentIds.has(sidebarContinuityAnchor.key)) {
9175
9239
  const removedContinuityKey = sidebarContinuityAnchor.key;
9176
9240
  if (!preserveSidebarContinuityAfterRemoval(removedContinuityKey, currentIds)) {
@@ -9229,11 +9293,13 @@ var _sfc_main$30 = {
9229
9293
  setupObserver();
9230
9294
  props.parent?.addEventListener?.("scroll", refreshViewportWindow, { passive: true });
9231
9295
  window.addEventListener("resize", refreshViewportWindow, { passive: true });
9296
+ document.addEventListener("pointerdown", releaseDirectDecisionContinuityForUnrelatedPointer, true);
9232
9297
  (0, vue.nextTick)(observePlaceholders);
9233
9298
  });
9234
9299
  (0, vue.onBeforeUnmount)(() => {
9235
9300
  clearDeferredRemeasureTimers();
9236
9301
  if (scrollTimer) clearTimeout(scrollTimer);
9302
+ releaseDirectDecisionContinuity();
9237
9303
  clearSidebarContinuityAnchor();
9238
9304
  if (activeLayoutContinuityFrame != null) {
9239
9305
  cancelAnimationFrame(activeLayoutContinuityFrame);
@@ -9241,6 +9307,7 @@ var _sfc_main$30 = {
9241
9307
  }
9242
9308
  props.parent?.removeEventListener?.("scroll", refreshViewportWindow);
9243
9309
  window.removeEventListener("resize", refreshViewportWindow);
9310
+ document.removeEventListener("pointerdown", releaseDirectDecisionContinuityForUnrelatedPointer, true);
9244
9311
  if (viewportFrame != null) {
9245
9312
  cancelAnimationFrame(viewportFrame);
9246
9313
  viewportFrame = null;
@@ -9256,6 +9323,7 @@ var _sfc_main$30 = {
9256
9323
  class: "section-wrapper",
9257
9324
  ref_key: "floatingCommentsContainer",
9258
9325
  ref: floatingCommentsContainer,
9326
+ onClickCapture: prepareSidebarContinuityForDirectDecision,
9259
9327
  style: (0, vue.normalizeStyle)({
9260
9328
  minHeight: wrapperMinHeight.value + "px",
9261
9329
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
@@ -9276,12 +9344,12 @@ var _sfc_main$30 = {
9276
9344
  "data-comment-thread-id": pos.threadId,
9277
9345
  "data-comment-position-key": pos.instanceRef?.positionKey ?? "",
9278
9346
  "data-comment-page-index": pos.pageIndex ?? "",
9347
+ class: (0, vue.normalizeClass)([{ "is-direct-decision-continuity-target": pos.id === directDecisionContinuityTargetId.value }, "comment-placeholder"]),
9279
9348
  style: (0, vue.normalizeStyle)({
9280
9349
  top: pos.top + "px",
9281
9350
  height: pos.height + "px",
9282
9351
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
9283
- }),
9284
- class: "comment-placeholder"
9352
+ })
9285
9353
  }, [shouldRenderDialog(pos) ? ((0, vue.openBlock)(), (0, vue.createBlock)(CommentDialog_default, {
9286
9354
  key: pos.id + commentsRenderKey.value,
9287
9355
  onReady: handleDialog,
@@ -9301,12 +9369,12 @@ var _sfc_main$30 = {
9301
9369
  "floating-page-index",
9302
9370
  "floating-position-entry",
9303
9371
  "is-floating-instance-active"
9304
- ])) : (0, vue.createCommentVNode)("", true)], 12, _hoisted_1$23);
9305
- }), 128))], 4)], 4);
9372
+ ])) : (0, vue.createCommentVNode)("", true)], 14, _hoisted_1$23);
9373
+ }), 128))], 4)], 36);
9306
9374
  };
9307
9375
  }
9308
9376
  };
9309
- var FloatingComments_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$30, [["__scopeId", "data-v-e699ceb8"]]);
9377
+ var FloatingComments_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$30, [["__scopeId", "data-v-7f4821a8"]]);
9310
9378
  var _hoisted_1$22 = {
9311
9379
  class: "superdoc__pdf-comments-layer pdf-comments-layer",
9312
9380
  "aria-hidden": "false"
@@ -14235,8 +14303,8 @@ var _sfc_main$20 = {
14235
14303
  if (typeof replaceFile !== "function") throw new Error("v2-editor: replaceFile unavailable");
14236
14304
  return replaceFile(source);
14237
14305
  };
14238
- const focusV2Editable = () => {
14239
- if (mount?.focus && typeof mount.focus.focus === "function") return mount.focus.focus();
14306
+ const focusV2Editable = (options = {}) => {
14307
+ if (mount?.focus && typeof mount.focus.focus === "function") return mount.focus.focus(options);
14240
14308
  return false;
14241
14309
  };
14242
14310
  const createV2AuthoringFailure = (reason, detail = void 0) => {
@@ -16120,7 +16188,7 @@ var _sfc_main$20 = {
16120
16188
  };
16121
16189
  }
16122
16190
  };
16123
- var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-4084bf1b"]]);
16191
+ var SuperDoc_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$20, [["__scopeId", "data-v-91c4cd11"]]);
16124
16192
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
16125
16193
  var PINIA_DEVTOOLS_PLUGIN_ID = "dev.esm.pinia";
16126
16194
  var piniaDevtoolsSuppressionState = {
@@ -30033,7 +30101,7 @@ var _sfc_main$14 = {
30033
30101
  query.value = "";
30034
30102
  inputDisplay.value = appliedLabel.value;
30035
30103
  event.preventDefault();
30036
- inputRef.value?.focus();
30104
+ inputRef.value?.focus({ preventScroll: true });
30037
30105
  setSelectionRange(0, appliedLabel.value.length);
30038
30106
  }
30039
30107
  if (!isOpen.value) {
@@ -30343,7 +30411,7 @@ var _sfc_main$14 = {
30343
30411
  };
30344
30412
  }
30345
30413
  };
30346
- var ToolbarComboBox_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$14, [["__scopeId", "data-v-c08c573e"]]);
30414
+ var ToolbarComboBox_default = /* @__PURE__ */ require__plugin_vue_export_helper.__plugin_vue_export_helper_default(_sfc_main$14, [["__scopeId", "data-v-99070b63"]]);
30347
30415
  var _sfc_main$13 = {
30348
30416
  __name: "FontFamilyCombobox",
30349
30417
  props: {
@@ -34695,7 +34763,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
34695
34763
  this.config.colors = shuffleArray(this.config.colors);
34696
34764
  this.userColorMap = /* @__PURE__ */ new Map();
34697
34765
  this.colorIndex = 0;
34698
- this.version = "2.0.0-next.37";
34766
+ this.version = "2.0.0-next.39";
34699
34767
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34700
34768
  this.superdocId = config.superdocId || require_uuid.v4_default();
34701
34769
  this.colors = this.config.colors ?? [];
@@ -36222,19 +36290,21 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
36222
36290
  this.#mountWrapper = null;
36223
36291
  }
36224
36292
  }
36225
- focus() {
36293
+ focus(options = {}) {
36226
36294
  const runtime = this.getActiveRuntime();
36227
36295
  if (runtime?.getCapabilities().lifecycle.canFocus) {
36228
- runtime.focus().catch((err) => {
36296
+ runtime.focus(options).catch((err) => {
36229
36297
  console.warn("[SuperDoc] active editor runtime focus failed", err);
36230
36298
  });
36231
36299
  return;
36232
36300
  }
36233
- if (this.activeEditor) this.activeEditor.focus?.();
36301
+ if (this.activeEditor) if (isV2ActiveEditorFacade(this.activeEditor)) this.activeEditor.focus?.(options);
36302
+ else this.activeEditor.focus?.();
36234
36303
  else this.#requireSuperdocStore("focus").documents.find((doc) => {
36235
36304
  const editor = doc.getEditor?.();
36236
36305
  if (!editor) return false;
36237
- editor.focus?.();
36306
+ if (isV2ActiveEditorFacade(editor)) editor.focus?.(options);
36307
+ else editor.focus?.();
36238
36308
  return true;
36239
36309
  });
36240
36310
  }
@@ -5,7 +5,7 @@ import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
5
5
  import { a as init_dist, i as global, n as init_dist$1, r as process$1, t as require_jszip_min } from "./chunks/jszip-DzmwAHr3.es.js";
6
6
  import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-CInC0bKI.es.js";
7
7
  import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-CY3R3_kF.es.js";
8
- import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-C_kKiKQ4.es.js";
8
+ import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BDAxgGrE.es.js";
9
9
  import * as Vue from "vue";
10
10
  import { Fragment, Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, h, inject, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, openBlock, reactive, ref, renderList, renderSlot, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, unref, useAttrs, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
11
11
  import "y-websocket";
@@ -7757,7 +7757,7 @@ var CommentDialog_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
7757
7757
  commentsStore.lastUpdate = /* @__PURE__ */ new Date();
7758
7758
  activeComment.value = null;
7759
7759
  commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
7760
- proxy.$superdoc.focus?.();
7760
+ proxy.$superdoc.focus?.({ preventScroll: true });
7761
7761
  });
7762
7762
  return;
7763
7763
  }
@@ -7817,7 +7817,7 @@ var CommentDialog_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
7817
7817
  commentsStore.lastUpdate = /* @__PURE__ */ new Date();
7818
7818
  activeComment.value = null;
7819
7819
  commentsStore.setActiveComment(proxy.$superdoc, activeComment.value);
7820
- proxy.$superdoc.focus?.();
7820
+ proxy.$superdoc.focus?.({ preventScroll: true });
7821
7821
  });
7822
7822
  return;
7823
7823
  }
@@ -8203,7 +8203,7 @@ var CommentDialog_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
8203
8203
  ], 64))], 14, _hoisted_1$25)), [[_directive_click_outside, handleClickOutside]]);
8204
8204
  };
8205
8205
  }
8206
- }, [["__scopeId", "data-v-74340036"]]);
8206
+ }, [["__scopeId", "data-v-387d6ba0"]]);
8207
8207
  var _hoisted_1$24 = { class: "comments-list" };
8208
8208
  var _hoisted_2$19 = { key: 0 };
8209
8209
  var _hoisted_3$15 = [
@@ -8632,6 +8632,7 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
8632
8632
  const commentsRenderKey = ref(0);
8633
8633
  const sidebarOffsetY = ref(0);
8634
8634
  const disableInstantLayoutTransitions = ref(false);
8635
+ const directDecisionContinuityTargetId = ref(null);
8635
8636
  const viewportRevision = ref(0);
8636
8637
  const isPendingThread = (commentOrId) => {
8637
8638
  const pendingId = pendingComment.value?.commentId;
@@ -8926,6 +8927,7 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
8926
8927
  });
8927
8928
  };
8928
8929
  const setInstantLayoutTransitionsDisabled = (disabled) => {
8930
+ if (!disabled && directDecisionContinuityTargetId.value != null) return;
8929
8931
  disableInstantLayoutTransitions.value = disabled;
8930
8932
  };
8931
8933
  const alignCommentKeyToClientY = (key, targetY, onComplete) => {
@@ -8966,6 +8968,20 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
8966
8968
  let continuityAlignmentGeneration = 0;
8967
8969
  let continuityTransitionFrame = null;
8968
8970
  let activeLayoutContinuityFrame = null;
8971
+ let directDecisionContinuity = null;
8972
+ let directDecisionSourceId = null;
8973
+ const releaseDirectDecisionContinuity = () => {
8974
+ directDecisionContinuity = null;
8975
+ directDecisionSourceId = null;
8976
+ directDecisionContinuityTargetId.value = null;
8977
+ setInstantLayoutTransitionsDisabled(false);
8978
+ };
8979
+ const releaseDirectDecisionContinuityForUnrelatedPointer = (event) => {
8980
+ if (!directDecisionContinuity) return;
8981
+ const actionElement = (event?.target instanceof Element ? event.target : null)?.closest?.("[data-comment-action]");
8982
+ const action = actionElement?.getAttribute?.("data-comment-action");
8983
+ if (!((action === "resolve" || action === "reject") && floatingCommentsContainer.value?.contains?.(actionElement))) releaseDirectDecisionContinuity();
8984
+ };
8969
8985
  const clearDeferredRemeasureTimers = () => {
8970
8986
  remeasureTimers.forEach(clearTimeout);
8971
8987
  remeasureTimers = [];
@@ -9061,13 +9077,48 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9061
9077
  scheduleSidebarContinuityAlignment();
9062
9078
  return true;
9063
9079
  };
9080
+ const prepareSidebarContinuityForDirectDecision = (event) => {
9081
+ const actionElement = event?.target?.closest?.("[data-comment-action]");
9082
+ const action = actionElement?.getAttribute?.("data-comment-action");
9083
+ if (action !== "resolve" && action !== "reject") return;
9084
+ releaseDirectDecisionContinuity();
9085
+ if (actionElement.getAttribute?.("aria-disabled") === "true") return;
9086
+ const removedKey = (actionElement.closest?.("[data-comment-id]"))?.getAttribute?.("data-comment-id");
9087
+ if (!removedKey || String(activeCommentInstanceId.value ?? "") === String(removedKey)) return;
9088
+ const previousIds = allPositions.value.filter((position) => position.commentRef?.trackedChange).map((position, index) => ({
9089
+ id: position.id,
9090
+ index,
9091
+ top: position.top
9092
+ })).filter((position) => Number.isFinite(position.top)).sort((left, right) => left.top - right.top || left.index - right.index).map((position) => position.id);
9093
+ const targetKey = resolveRemovedReviewCardContinuityTarget({
9094
+ previousIds,
9095
+ currentIds: new Set(previousIds),
9096
+ removedId: removedKey
9097
+ });
9098
+ const targetClientY = (targetKey ? placeholderRefs.value[targetKey] : null)?.getBoundingClientRect?.().top;
9099
+ if (!targetKey || !Number.isFinite(targetClientY)) return;
9100
+ directDecisionContinuity = {
9101
+ removedKey,
9102
+ targetKey,
9103
+ targetClientY,
9104
+ applied: false
9105
+ };
9106
+ directDecisionSourceId = removedKey;
9107
+ directDecisionContinuityTargetId.value = targetKey;
9108
+ setInstantLayoutTransitionsDisabled(true);
9109
+ };
9064
9110
  watch(activeCommentInstanceId, (newKey, oldKey) => {
9065
9111
  clearDeferredRemeasureTimers();
9066
- if (newKey) clearSidebarContinuityAnchor();
9067
- else if (oldKey) {
9068
- const currentIds = new Set(allPositions.value.map((position) => position.id));
9069
- if (!currentIds.has(oldKey)) preserveSidebarContinuityAfterRemoval(oldKey, currentIds);
9070
- else clearSidebarContinuityAnchor();
9112
+ if (!(directDecisionContinuity != null && directDecisionSourceId != null && [newKey, oldKey].some((key) => key != null && String(key) === String(directDecisionSourceId)))) {
9113
+ directDecisionSourceId = null;
9114
+ if (newKey) {
9115
+ releaseDirectDecisionContinuity();
9116
+ clearSidebarContinuityAnchor();
9117
+ } else if (oldKey) {
9118
+ const currentIds = new Set(allPositions.value.map((position) => position.id));
9119
+ if (!currentIds.has(oldKey)) preserveSidebarContinuityAfterRemoval(oldKey, currentIds);
9120
+ else clearSidebarContinuityAnchor();
9121
+ }
9071
9122
  }
9072
9123
  const keysToRemeasure = [newKey, oldKey];
9073
9124
  const hasPendingInstantAlignment = newKey && newKey === instantAlignmentInstanceKey.value && Number.isFinite(instantSidebarAlignmentTargetY.value);
@@ -9160,6 +9211,19 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9160
9211
  prevActiveLayoutTop = activeLayoutTop;
9161
9212
  const positionOrder = positions.map((position) => position.id);
9162
9213
  const currentIds = new Set(positionOrder);
9214
+ if (directDecisionContinuity && !directDecisionContinuity.applied && !currentIds.has(directDecisionContinuity.removedKey)) {
9215
+ const { targetKey, targetClientY } = directDecisionContinuity;
9216
+ directDecisionContinuity.applied = true;
9217
+ if (currentIds.has(targetKey) && Number.isFinite(targetClientY)) {
9218
+ sidebarContinuityAnchor = {
9219
+ key: targetKey,
9220
+ targetClientY
9221
+ };
9222
+ continuityAlignmentGeneration += 1;
9223
+ scheduleSidebarContinuityAlignment();
9224
+ } else releaseDirectDecisionContinuity();
9225
+ }
9226
+ if (directDecisionContinuity?.applied && !currentIds.has(directDecisionContinuity.targetKey)) releaseDirectDecisionContinuity();
9163
9227
  if (sidebarContinuityAnchor && !currentIds.has(sidebarContinuityAnchor.key)) {
9164
9228
  const removedContinuityKey = sidebarContinuityAnchor.key;
9165
9229
  if (!preserveSidebarContinuityAfterRemoval(removedContinuityKey, currentIds)) {
@@ -9218,11 +9282,13 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9218
9282
  setupObserver();
9219
9283
  props.parent?.addEventListener?.("scroll", refreshViewportWindow, { passive: true });
9220
9284
  window.addEventListener("resize", refreshViewportWindow, { passive: true });
9285
+ document.addEventListener("pointerdown", releaseDirectDecisionContinuityForUnrelatedPointer, true);
9221
9286
  nextTick(observePlaceholders);
9222
9287
  });
9223
9288
  onBeforeUnmount(() => {
9224
9289
  clearDeferredRemeasureTimers();
9225
9290
  if (scrollTimer) clearTimeout(scrollTimer);
9291
+ releaseDirectDecisionContinuity();
9226
9292
  clearSidebarContinuityAnchor();
9227
9293
  if (activeLayoutContinuityFrame != null) {
9228
9294
  cancelAnimationFrame(activeLayoutContinuityFrame);
@@ -9230,6 +9296,7 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9230
9296
  }
9231
9297
  props.parent?.removeEventListener?.("scroll", refreshViewportWindow);
9232
9298
  window.removeEventListener("resize", refreshViewportWindow);
9299
+ document.removeEventListener("pointerdown", releaseDirectDecisionContinuityForUnrelatedPointer, true);
9233
9300
  if (viewportFrame != null) {
9234
9301
  cancelAnimationFrame(viewportFrame);
9235
9302
  viewportFrame = null;
@@ -9245,6 +9312,7 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9245
9312
  class: "section-wrapper",
9246
9313
  ref_key: "floatingCommentsContainer",
9247
9314
  ref: floatingCommentsContainer,
9315
+ onClickCapture: prepareSidebarContinuityForDirectDecision,
9248
9316
  style: normalizeStyle({
9249
9317
  minHeight: wrapperMinHeight.value + "px",
9250
9318
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
@@ -9265,12 +9333,12 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9265
9333
  "data-comment-thread-id": pos.threadId,
9266
9334
  "data-comment-position-key": pos.instanceRef?.positionKey ?? "",
9267
9335
  "data-comment-page-index": pos.pageIndex ?? "",
9336
+ class: normalizeClass([{ "is-direct-decision-continuity-target": pos.id === directDecisionContinuityTargetId.value }, "comment-placeholder"]),
9268
9337
  style: normalizeStyle({
9269
9338
  top: pos.top + "px",
9270
9339
  height: pos.height + "px",
9271
9340
  transition: disableInstantLayoutTransitions.value ? "none" : void 0
9272
- }),
9273
- class: "comment-placeholder"
9341
+ })
9274
9342
  }, [shouldRenderDialog(pos) ? (openBlock(), createBlock(CommentDialog_default, {
9275
9343
  key: pos.id + commentsRenderKey.value,
9276
9344
  onReady: handleDialog,
@@ -9290,11 +9358,11 @@ var FloatingComments_default = /* @__PURE__ */ __plugin_vue_export_helper_defaul
9290
9358
  "floating-page-index",
9291
9359
  "floating-position-entry",
9292
9360
  "is-floating-instance-active"
9293
- ])) : createCommentVNode("", true)], 12, _hoisted_1$23);
9294
- }), 128))], 4)], 4);
9361
+ ])) : createCommentVNode("", true)], 14, _hoisted_1$23);
9362
+ }), 128))], 4)], 36);
9295
9363
  };
9296
9364
  }
9297
- }, [["__scopeId", "data-v-e699ceb8"]]);
9365
+ }, [["__scopeId", "data-v-7f4821a8"]]);
9298
9366
  var _hoisted_1$22 = {
9299
9367
  class: "superdoc__pdf-comments-layer pdf-comments-layer",
9300
9368
  "aria-hidden": "false"
@@ -14196,8 +14264,8 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
14196
14264
  if (typeof replaceFile !== "function") throw new Error("v2-editor: replaceFile unavailable");
14197
14265
  return replaceFile(source);
14198
14266
  };
14199
- const focusV2Editable = () => {
14200
- if (mount?.focus && typeof mount.focus.focus === "function") return mount.focus.focus();
14267
+ const focusV2Editable = (options = {}) => {
14268
+ if (mount?.focus && typeof mount.focus.focus === "function") return mount.focus.focus(options);
14201
14269
  return false;
14202
14270
  };
14203
14271
  const createV2AuthoringFailure = (reason, detail = void 0) => {
@@ -16080,7 +16148,7 @@ var SuperDoc_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
16080
16148
  ], 38);
16081
16149
  };
16082
16150
  }
16083
- }, [["__scopeId", "data-v-4084bf1b"]]);
16151
+ }, [["__scopeId", "data-v-91c4cd11"]]);
16084
16152
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
16085
16153
  var PINIA_DEVTOOLS_PLUGIN_ID = "dev.esm.pinia";
16086
16154
  var piniaDevtoolsSuppressionState = {
@@ -29986,7 +30054,7 @@ var ToolbarComboBox_default = /* @__PURE__ */ __plugin_vue_export_helper_default
29986
30054
  query.value = "";
29987
30055
  inputDisplay.value = appliedLabel.value;
29988
30056
  event.preventDefault();
29989
- inputRef.value?.focus();
30057
+ inputRef.value?.focus({ preventScroll: true });
29990
30058
  setSelectionRange(0, appliedLabel.value.length);
29991
30059
  }
29992
30060
  if (!isOpen.value) {
@@ -30295,7 +30363,7 @@ var ToolbarComboBox_default = /* @__PURE__ */ __plugin_vue_export_helper_default
30295
30363
  ], 14, _hoisted_1$10);
30296
30364
  };
30297
30365
  }
30298
- }, [["__scopeId", "data-v-c08c573e"]]);
30366
+ }, [["__scopeId", "data-v-99070b63"]]);
30299
30367
  var FontFamilyCombobox_default = {
30300
30368
  __name: "FontFamilyCombobox",
30301
30369
  props: {
@@ -34632,7 +34700,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34632
34700
  this.config.colors = shuffleArray(this.config.colors);
34633
34701
  this.userColorMap = /* @__PURE__ */ new Map();
34634
34702
  this.colorIndex = 0;
34635
- this.version = "2.0.0-next.37";
34703
+ this.version = "2.0.0-next.39";
34636
34704
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34637
34705
  this.superdocId = config.superdocId || v4_default();
34638
34706
  this.colors = this.config.colors ?? [];
@@ -36159,19 +36227,21 @@ var SuperDoc = class extends import_eventemitter3.default {
36159
36227
  this.#mountWrapper = null;
36160
36228
  }
36161
36229
  }
36162
- focus() {
36230
+ focus(options = {}) {
36163
36231
  const runtime = this.getActiveRuntime();
36164
36232
  if (runtime?.getCapabilities().lifecycle.canFocus) {
36165
- runtime.focus().catch((err) => {
36233
+ runtime.focus(options).catch((err) => {
36166
36234
  console.warn("[SuperDoc] active editor runtime focus failed", err);
36167
36235
  });
36168
36236
  return;
36169
36237
  }
36170
- if (this.activeEditor) this.activeEditor.focus?.();
36238
+ if (this.activeEditor) if (isV2ActiveEditorFacade(this.activeEditor)) this.activeEditor.focus?.(options);
36239
+ else this.activeEditor.focus?.();
36171
36240
  else this.#requireSuperdocStore("focus").documents.find((doc) => {
36172
36241
  const editor = doc.getEditor?.();
36173
36242
  if (!editor) return false;
36174
- editor.focus?.();
36243
+ if (isV2ActiveEditorFacade(editor)) editor.focus?.(options);
36244
+ else editor.focus?.();
36175
36245
  return true;
36176
36246
  });
36177
36247
  }