@harbour-enterprises/superdoc 0.27.0-next.1 → 0.27.0-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.
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DP1njdRr.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DATrA3lt.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-BXLDmCzi.cjs");
4
+ const superdoc = require("./index-EIErxDyE.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DLyAUJ56.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DtgJu0CH.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -17145,7 +17145,7 @@ const _sfc_main = {
17145
17145
  __name: "SuperDoc",
17146
17146
  emits: ["selection-update"],
17147
17147
  setup(__props, { emit: __emit }) {
17148
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CegNKOLN.es.js"));
17148
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BYzQ-Z8r.es.js"));
17149
17149
  const superdocStore = useSuperdocStore();
17150
17150
  const commentsStore = useCommentsStore();
17151
17151
  const {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-ihBKB9j_.cjs");
2
+ const superEditor_es = require("./super-editor.es-DXEbSokY.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -17162,7 +17162,7 @@ const _sfc_main = {
17162
17162
  __name: "SuperDoc",
17163
17163
  emits: ["selection-update"],
17164
17164
  setup(__props, { emit: __emit }) {
17165
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Caa3ZJY4.cjs")));
17165
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CaR2rmuW.cjs")));
17166
17166
  const superdocStore = useSuperdocStore();
17167
17167
  const commentsStore = useCommentsStore();
17168
17168
  const {
@@ -59286,6 +59286,8 @@ const defaultLineLength = 816;
59286
59286
  const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59287
59287
  const decorations = [];
59288
59288
  const paragraphCache = /* @__PURE__ */ new Map();
59289
+ const coordCache = /* @__PURE__ */ new Map();
59290
+ const domPosCache = /* @__PURE__ */ new Map();
59289
59291
  const end2 = to ?? doc2.content.size;
59290
59292
  doc2.nodesBetween(from2, end2, (node, pos) => {
59291
59293
  if (node.type.name !== "tab") return;
@@ -59297,9 +59299,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59297
59299
  const { tabStops, flattened, startPos } = paragraphContext;
59298
59300
  const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
59299
59301
  if (entryIndex === -1) return;
59300
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
59302
+ const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59301
59303
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
59302
- const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
59304
+ const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
59303
59305
  let tabWidth;
59304
59306
  if (tabStops.length) {
59305
59307
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
@@ -59309,12 +59311,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59309
59311
  const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
59310
59312
  const segmentStartPos = pos + node.nodeSize;
59311
59313
  const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
59312
- const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
59314
+ const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
59313
59315
  tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
59314
59316
  } else if (tabStop.val === "decimal" || tabStop.val === "num") {
59315
59317
  const breakChar = tabStop.decimalChar || ".";
59316
59318
  const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
59317
- const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(view, pos + node.nodeSize, startPos + paragraphContext.paragraph.nodeSize - 1);
59319
+ const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
59320
+ view,
59321
+ pos + node.nodeSize,
59322
+ startPos + paragraphContext.paragraph.nodeSize - 1,
59323
+ coordCache,
59324
+ domPosCache
59325
+ );
59318
59326
  tabWidth -= integralWidth;
59319
59327
  }
59320
59328
  if (tabStop.leader) {
@@ -59417,27 +59425,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
59417
59425
  }
59418
59426
  return null;
59419
59427
  }
59420
- function measureRangeWidth(view, from2, to) {
59428
+ function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
59421
59429
  if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
59422
59430
  try {
59423
59431
  const range2 = document.createRange();
59424
- const fromRef = view.domAtPos(from2);
59425
- const toRef = view.domAtPos(to);
59432
+ const fromRef = getCachedDomAtPos(view, from2, domPosCache);
59433
+ const toRef = getCachedDomAtPos(view, to, domPosCache);
59426
59434
  range2.setStart(fromRef.node, fromRef.offset);
59427
59435
  range2.setEnd(toRef.node, toRef.offset);
59428
59436
  const rect = range2.getBoundingClientRect();
59429
59437
  range2.detach?.();
59430
59438
  return rect.width || 0;
59431
59439
  } catch {
59432
- const startLeft = getLeftCoord(view, from2);
59433
- const endLeft = getLeftCoord(view, to);
59440
+ const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
59441
+ const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
59434
59442
  if (startLeft == null || endLeft == null) return 0;
59435
59443
  return Math.max(0, endLeft - startLeft);
59436
59444
  }
59437
59445
  }
59438
- function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
59439
- const marginLeft = getLeftCoord(view, paragraphStartPos);
59440
- const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
59446
+ function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
59447
+ const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
59448
+ const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
59441
59449
  if (marginLeft != null && lineLeft != null) {
59442
59450
  const diff = lineLeft - marginLeft;
59443
59451
  if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
@@ -59468,23 +59476,41 @@ function calculateIndentFallback(indentAttrs = {}) {
59468
59476
  if (left2) return left2;
59469
59477
  return 0;
59470
59478
  }
59471
- function getLeftCoord(view, pos) {
59479
+ function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
59472
59480
  if (!Number.isFinite(pos)) return null;
59481
+ if (coordCache && coordCache.has(pos)) {
59482
+ return coordCache.get(pos);
59483
+ }
59484
+ let result = null;
59473
59485
  try {
59474
- return view.coordsAtPos(pos).left;
59486
+ result = view.coordsAtPos(pos).left;
59475
59487
  } catch {
59476
59488
  try {
59477
- const ref2 = view.domAtPos(pos);
59489
+ const ref2 = getCachedDomAtPos(view, pos, domPosCache);
59478
59490
  const range2 = document.createRange();
59479
59491
  range2.setStart(ref2.node, ref2.offset);
59480
59492
  range2.setEnd(ref2.node, ref2.offset);
59481
59493
  const rect = range2.getBoundingClientRect();
59482
59494
  range2.detach?.();
59483
- return rect.left;
59495
+ result = rect.left;
59484
59496
  } catch {
59485
- return null;
59497
+ result = null;
59486
59498
  }
59487
59499
  }
59500
+ if (coordCache) {
59501
+ coordCache.set(pos, result);
59502
+ }
59503
+ return result;
59504
+ }
59505
+ function getCachedDomAtPos(view, pos, domPosCache = null) {
59506
+ if (domPosCache && domPosCache.has(pos)) {
59507
+ return domPosCache.get(pos);
59508
+ }
59509
+ const result = view.domAtPos(pos);
59510
+ if (domPosCache) {
59511
+ domPosCache.set(pos, result);
59512
+ }
59513
+ return result;
59488
59514
  }
59489
59515
  function calcTabHeight(pos) {
59490
59516
  const ptToPxRatio = 1.333;
@@ -59269,6 +59269,8 @@ const defaultLineLength = 816;
59269
59269
  const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59270
59270
  const decorations = [];
59271
59271
  const paragraphCache = /* @__PURE__ */ new Map();
59272
+ const coordCache = /* @__PURE__ */ new Map();
59273
+ const domPosCache = /* @__PURE__ */ new Map();
59272
59274
  const end2 = to ?? doc2.content.size;
59273
59275
  doc2.nodesBetween(from2, end2, (node, pos) => {
59274
59276
  if (node.type.name !== "tab") return;
@@ -59280,9 +59282,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59280
59282
  const { tabStops, flattened, startPos } = paragraphContext;
59281
59283
  const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
59282
59284
  if (entryIndex === -1) return;
59283
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
59285
+ const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59284
59286
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
59285
- const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
59287
+ const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
59286
59288
  let tabWidth;
59287
59289
  if (tabStops.length) {
59288
59290
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
@@ -59292,12 +59294,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59292
59294
  const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
59293
59295
  const segmentStartPos = pos + node.nodeSize;
59294
59296
  const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
59295
- const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
59297
+ const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
59296
59298
  tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
59297
59299
  } else if (tabStop.val === "decimal" || tabStop.val === "num") {
59298
59300
  const breakChar = tabStop.decimalChar || ".";
59299
59301
  const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
59300
- const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(view, pos + node.nodeSize, startPos + paragraphContext.paragraph.nodeSize - 1);
59302
+ const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
59303
+ view,
59304
+ pos + node.nodeSize,
59305
+ startPos + paragraphContext.paragraph.nodeSize - 1,
59306
+ coordCache,
59307
+ domPosCache
59308
+ );
59301
59309
  tabWidth -= integralWidth;
59302
59310
  }
59303
59311
  if (tabStop.leader) {
@@ -59400,27 +59408,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
59400
59408
  }
59401
59409
  return null;
59402
59410
  }
59403
- function measureRangeWidth(view, from2, to) {
59411
+ function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
59404
59412
  if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
59405
59413
  try {
59406
59414
  const range2 = document.createRange();
59407
- const fromRef = view.domAtPos(from2);
59408
- const toRef2 = view.domAtPos(to);
59415
+ const fromRef = getCachedDomAtPos(view, from2, domPosCache);
59416
+ const toRef2 = getCachedDomAtPos(view, to, domPosCache);
59409
59417
  range2.setStart(fromRef.node, fromRef.offset);
59410
59418
  range2.setEnd(toRef2.node, toRef2.offset);
59411
59419
  const rect = range2.getBoundingClientRect();
59412
59420
  range2.detach?.();
59413
59421
  return rect.width || 0;
59414
59422
  } catch {
59415
- const startLeft = getLeftCoord(view, from2);
59416
- const endLeft = getLeftCoord(view, to);
59423
+ const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
59424
+ const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
59417
59425
  if (startLeft == null || endLeft == null) return 0;
59418
59426
  return Math.max(0, endLeft - startLeft);
59419
59427
  }
59420
59428
  }
59421
- function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
59422
- const marginLeft = getLeftCoord(view, paragraphStartPos);
59423
- const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
59429
+ function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
59430
+ const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
59431
+ const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
59424
59432
  if (marginLeft != null && lineLeft != null) {
59425
59433
  const diff = lineLeft - marginLeft;
59426
59434
  if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
@@ -59451,23 +59459,41 @@ function calculateIndentFallback(indentAttrs = {}) {
59451
59459
  if (left2) return left2;
59452
59460
  return 0;
59453
59461
  }
59454
- function getLeftCoord(view, pos) {
59462
+ function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
59455
59463
  if (!Number.isFinite(pos)) return null;
59464
+ if (coordCache && coordCache.has(pos)) {
59465
+ return coordCache.get(pos);
59466
+ }
59467
+ let result = null;
59456
59468
  try {
59457
- return view.coordsAtPos(pos).left;
59469
+ result = view.coordsAtPos(pos).left;
59458
59470
  } catch {
59459
59471
  try {
59460
- const ref2 = view.domAtPos(pos);
59472
+ const ref2 = getCachedDomAtPos(view, pos, domPosCache);
59461
59473
  const range2 = document.createRange();
59462
59474
  range2.setStart(ref2.node, ref2.offset);
59463
59475
  range2.setEnd(ref2.node, ref2.offset);
59464
59476
  const rect = range2.getBoundingClientRect();
59465
59477
  range2.detach?.();
59466
- return rect.left;
59478
+ result = rect.left;
59467
59479
  } catch {
59468
- return null;
59480
+ result = null;
59469
59481
  }
59470
59482
  }
59483
+ if (coordCache) {
59484
+ coordCache.set(pos, result);
59485
+ }
59486
+ return result;
59487
+ }
59488
+ function getCachedDomAtPos(view, pos, domPosCache = null) {
59489
+ if (domPosCache && domPosCache.has(pos)) {
59490
+ return domPosCache.get(pos);
59491
+ }
59492
+ const result = view.domAtPos(pos);
59493
+ if (domPosCache) {
59494
+ domPosCache.set(pos, result);
59495
+ }
59496
+ return result;
59471
59497
  }
59472
59498
  function calcTabHeight(pos) {
59473
59499
  const ptToPxRatio = 1.333;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
2
  import { T as TextSelection } from "./chunks/converter-BupPKWvT.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Chw_8G5O.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-ByRd7RN8.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -20808,6 +20808,8 @@ const defaultLineLength = 816;
20808
20808
  const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20809
20809
  const decorations = [];
20810
20810
  const paragraphCache = /* @__PURE__ */ new Map();
20811
+ const coordCache = /* @__PURE__ */ new Map();
20812
+ const domPosCache = /* @__PURE__ */ new Map();
20811
20813
  const end2 = to ?? doc2.content.size;
20812
20814
  doc2.nodesBetween(from2, end2, (node, pos) => {
20813
20815
  if (node.type.name !== "tab") return;
@@ -20819,9 +20821,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20819
20821
  const { tabStops, flattened, startPos } = paragraphContext;
20820
20822
  const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
20821
20823
  if (entryIndex === -1) return;
20822
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
20824
+ const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
20823
20825
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
20824
- const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
20826
+ const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
20825
20827
  let tabWidth;
20826
20828
  if (tabStops.length) {
20827
20829
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
@@ -20831,12 +20833,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20831
20833
  const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
20832
20834
  const segmentStartPos = pos + node.nodeSize;
20833
20835
  const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
20834
- const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
20836
+ const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
20835
20837
  tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
20836
20838
  } else if (tabStop.val === "decimal" || tabStop.val === "num") {
20837
20839
  const breakChar = tabStop.decimalChar || ".";
20838
20840
  const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
20839
- const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(view, pos + node.nodeSize, startPos + paragraphContext.paragraph.nodeSize - 1);
20841
+ const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
20842
+ view,
20843
+ pos + node.nodeSize,
20844
+ startPos + paragraphContext.paragraph.nodeSize - 1,
20845
+ coordCache,
20846
+ domPosCache
20847
+ );
20840
20848
  tabWidth -= integralWidth;
20841
20849
  }
20842
20850
  if (tabStop.leader) {
@@ -20939,27 +20947,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
20939
20947
  }
20940
20948
  return null;
20941
20949
  }
20942
- function measureRangeWidth(view, from2, to) {
20950
+ function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
20943
20951
  if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
20944
20952
  try {
20945
20953
  const range = document.createRange();
20946
- const fromRef = view.domAtPos(from2);
20947
- const toRef = view.domAtPos(to);
20954
+ const fromRef = getCachedDomAtPos(view, from2, domPosCache);
20955
+ const toRef = getCachedDomAtPos(view, to, domPosCache);
20948
20956
  range.setStart(fromRef.node, fromRef.offset);
20949
20957
  range.setEnd(toRef.node, toRef.offset);
20950
20958
  const rect = range.getBoundingClientRect();
20951
20959
  range.detach?.();
20952
20960
  return rect.width || 0;
20953
20961
  } catch {
20954
- const startLeft = getLeftCoord(view, from2);
20955
- const endLeft = getLeftCoord(view, to);
20962
+ const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
20963
+ const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
20956
20964
  if (startLeft == null || endLeft == null) return 0;
20957
20965
  return Math.max(0, endLeft - startLeft);
20958
20966
  }
20959
20967
  }
20960
- function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
20961
- const marginLeft = getLeftCoord(view, paragraphStartPos);
20962
- const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
20968
+ function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
20969
+ const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
20970
+ const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
20963
20971
  if (marginLeft != null && lineLeft != null) {
20964
20972
  const diff = lineLeft - marginLeft;
20965
20973
  if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
@@ -20990,23 +20998,41 @@ function calculateIndentFallback(indentAttrs = {}) {
20990
20998
  if (left2) return left2;
20991
20999
  return 0;
20992
21000
  }
20993
- function getLeftCoord(view, pos) {
21001
+ function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
20994
21002
  if (!Number.isFinite(pos)) return null;
21003
+ if (coordCache && coordCache.has(pos)) {
21004
+ return coordCache.get(pos);
21005
+ }
21006
+ let result = null;
20995
21007
  try {
20996
- return view.coordsAtPos(pos).left;
21008
+ result = view.coordsAtPos(pos).left;
20997
21009
  } catch {
20998
21010
  try {
20999
- const ref2 = view.domAtPos(pos);
21011
+ const ref2 = getCachedDomAtPos(view, pos, domPosCache);
21000
21012
  const range = document.createRange();
21001
21013
  range.setStart(ref2.node, ref2.offset);
21002
21014
  range.setEnd(ref2.node, ref2.offset);
21003
21015
  const rect = range.getBoundingClientRect();
21004
21016
  range.detach?.();
21005
- return rect.left;
21017
+ result = rect.left;
21006
21018
  } catch {
21007
- return null;
21019
+ result = null;
21008
21020
  }
21009
21021
  }
21022
+ if (coordCache) {
21023
+ coordCache.set(pos, result);
21024
+ }
21025
+ return result;
21026
+ }
21027
+ function getCachedDomAtPos(view, pos, domPosCache = null) {
21028
+ if (domPosCache && domPosCache.has(pos)) {
21029
+ return domPosCache.get(pos);
21030
+ }
21031
+ const result = view.domAtPos(pos);
21032
+ if (domPosCache) {
21033
+ domPosCache.set(pos, result);
21034
+ }
21035
+ return result;
21010
21036
  }
21011
21037
  function calcTabHeight(pos) {
21012
21038
  const ptToPxRatio = 1.333;
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
2
  import { p as process$1 } from "./converter-BupPKWvT.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Chw_8G5O.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-ByRd7RN8.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { E } from "./chunks/editor-Chw_8G5O.js";
1
+ import { E } from "./chunks/editor-ByRd7RN8.js";
2
2
  import "./chunks/converter-BupPKWvT.js";
3
3
  import "./chunks/docx-zipper-B_zB1qvo.js";
4
4
  export {
@@ -2,10 +2,11 @@ export function getParagraphContext($pos: any, cache: any, helpers: any): any;
2
2
  export function flattenParagraph(paragraph: any, paragraphStartPos: any): any[];
3
3
  export function findNextTabIndex(flattened: any, fromIndex: any): any;
4
4
  export function findDecimalBreakPos(flattened: any, startIndex: any, breakChar: any): any;
5
- export function measureRangeWidth(view: any, from: any, to: any): number;
6
- export function getIndentWidth(view: any, paragraphStartPos: any, indentAttrs?: {}): number;
5
+ export function measureRangeWidth(view: any, from: any, to: any, coordCache?: any, domPosCache?: any): number;
6
+ export function getIndentWidth(view: any, paragraphStartPos: any, indentAttrs?: {}, coordCache?: any, domPosCache?: any): number;
7
7
  export function calculateIndentFallback(indentAttrs?: {}): number;
8
- export function getLeftCoord(view: any, pos: any): any;
8
+ export function getLeftCoord(view: any, pos: any, coordCache?: any, domPosCache?: any): any;
9
+ export function getCachedDomAtPos(view: any, pos: any, domPosCache?: any): any;
9
10
  export function calcTabHeight(pos: any): string;
10
11
  export const defaultTabDistance: 48;
11
12
  export const defaultLineLength: 816;
@@ -11,10 +11,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
12
12
  import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-BupPKWvT.js";
13
13
  import { c1, a5, i, a2 } from "./chunks/converter-BupPKWvT.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-Chw_8G5O.js";
15
- import { t, C, v, T, p, w, q } from "./chunks/editor-Chw_8G5O.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-ByRd7RN8.js";
15
+ import { t, C, v, T, p, w, q } from "./chunks/editor-ByRd7RN8.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-D8p5YzRz.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BOxA8SfG.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
19
  import { D } from "./chunks/docx-zipper-B_zB1qvo.js";
20
20
  import { createZip } from "./file-zipper.es.js";
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-D8p5YzRz.js";
3
- import "./chunks/editor-Chw_8G5O.js";
2
+ import { T } from "./chunks/toolbar-BOxA8SfG.js";
3
+ import "./chunks/editor-ByRd7RN8.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-ihBKB9j_.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DXEbSokY.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DLyAUJ56.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DtgJu0CH.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-ihBKB9j_.cjs");
4
- const superdoc = require("./chunks/index-BXLDmCzi.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DXEbSokY.cjs");
4
+ const superdoc = require("./chunks/index-EIErxDyE.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DLyAUJ56.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DP1njdRr.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DtgJu0CH.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-DATrA3lt.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  export {