superdoc 2.21.0 → 2.22.0-next.10

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 (29) hide show
  1. package/dist/chunks/{create-super-doc-ui-yKesgn9b.cjs → create-super-doc-ui-DTLJMJIl.cjs} +1 -0
  2. package/dist/chunks/{create-super-doc-ui-0CZTlOvl.es.js → create-super-doc-ui-Dos1KQcL.es.js} +1 -0
  3. package/dist/collaboration-upgrade-engine.cjs +1 -1
  4. package/dist/collaboration-upgrade-engine.es.js +1 -1
  5. package/dist/document-api/src/contract/operation-definitions.d.ts +2 -2
  6. package/dist/document-api/src/diff/diff.types.d.ts +9 -0
  7. package/dist/document-api/src/index.d.ts +1 -1
  8. package/dist/document-api/src/selection/selection.d.ts +1 -1
  9. package/dist/document-api/src/selection/selection.types.d.ts +19 -1
  10. package/dist/layout-engine/contracts/src/index.d.ts +27 -1
  11. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +8 -0
  12. package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +8 -1
  13. package/dist/public/ui-react.cjs +1 -1
  14. package/dist/public/ui-react.es.js +1 -1
  15. package/dist/public/ui-vue.cjs +1 -1
  16. package/dist/public/ui-vue.es.js +1 -1
  17. package/dist/public/ui.cjs +1 -1
  18. package/dist/public/ui.es.js +1 -1
  19. package/dist/shared/font-system/src/document-font-options.d.ts +3 -9
  20. package/dist/style.css +22 -22
  21. package/dist/style.layered.css +22 -22
  22. package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +3 -0
  23. package/dist/superdoc/src/public/ui/types.d.ts +2 -0
  24. package/dist/superdoc.cjs +30 -6
  25. package/dist/superdoc.es.js +30 -6
  26. package/dist-cdn/style.layered.css +1 -1
  27. package/dist-cdn/superdoc.min.css +1 -1
  28. package/dist-cdn/superdoc.min.js +36 -36
  29. package/package.json +2 -2
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./chunks/rolldown-runtime-74VwNCz7.cjs");
3
3
  const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-yKesgn9b.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-DTLJMJIl.cjs");
5
5
  const require_eventemitter3 = require("./chunks/eventemitter3-C_TAnXOl.cjs");
6
6
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
7
7
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-CYxINHh_.cjs");
@@ -316,7 +316,7 @@ var shuffleArray = (array) => {
316
316
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
317
317
  function getSuperdocVersion() {
318
318
  try {
319
- return "2.21.0";
319
+ return "2.22.0-next.10";
320
320
  } catch {
321
321
  return "unknown";
322
322
  }
@@ -17363,6 +17363,17 @@ var shouldPreserveHostV2Selection = (documentMode, hostSnapshot) => {
17363
17363
  if (documentMode !== "editing" && documentMode !== "suggesting") return false;
17364
17364
  return isV2RangeSnapshot(hostSnapshot);
17365
17365
  };
17366
+ /**
17367
+ * A V2 paint can briefly have no DOM anchor while a selected control is being
17368
+ * rebuilt. Keep an already-positioned comment affordance during that gap when
17369
+ * the host still owns a range; otherwise the button unmounts and remounts on
17370
+ * consecutive paint frames, making it blink and intercepting its own click.
17371
+ *
17372
+ * @param {boolean} hasHostRange
17373
+ * @param {{ source?: unknown } | null | undefined} selectionPosition
17374
+ * @returns {boolean}
17375
+ */
17376
+ var shouldRetainV2FloatingSelection = (hasHostRange, selectionPosition) => hasHostRange === true && selectionPosition?.source === "document-editor";
17366
17377
  //#endregion
17367
17378
  //#region src/composables/use-password-prompt.js
17368
17379
  /** @typedef {import('../core/types').PasswordPromptConfig} PasswordPromptConfig */
@@ -21095,8 +21106,10 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21095
21106
  const { code, reason, severity } = diag;
21096
21107
  if (severity !== "error" && severity !== "warn") return null;
21097
21108
  if (code === "render.exact-content-hydration-failed") return null;
21109
+ const unusableFurniture = code === "render.header-footer.ref-unusable" || code === "render.header-footer.part-unusable";
21098
21110
  let diagnosticCode;
21099
- if (code.includes("page-geometry.failed") || code.includes("section-metadata.failed") || code.includes("page-furniture.failed") || code === "render.provider-error") diagnosticCode = "RENDER_ERROR";
21111
+ if (unusableFurniture) diagnosticCode = "PARSE_ERROR";
21112
+ else if (code.includes("page-geometry.failed") || code.includes("section-metadata.failed") || code.includes("page-furniture.failed") || code === "render.provider-error") diagnosticCode = "RENDER_ERROR";
21100
21113
  else if (code.includes("unsupported")) diagnosticCode = "UNSUPPORTED_FEATURE";
21101
21114
  else if (code.includes("degraded")) diagnosticCode = typeof reason === "string" && (reason.includes("retained ") || reason.includes("localized resolve ")) ? "RENDER_ERROR" : "PERFORMANCE_ERROR";
21102
21115
  else if (severity === "error") diagnosticCode = "RENDER_ERROR";
@@ -21105,7 +21118,7 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21105
21118
  return {
21106
21119
  error: new Error(message),
21107
21120
  diagnosticCode,
21108
- diagnosticStage: "render",
21121
+ diagnosticStage: unusableFurniture ? "parse" : "render",
21109
21122
  severity,
21110
21123
  internalCode: code,
21111
21124
  documentId: ctx.documentId ?? null,
@@ -23007,6 +23020,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23007
23020
  }
23008
23021
  const selection = buildV2FloatingSelection();
23009
23022
  if (!selection) {
23023
+ if (shouldRetainV2FloatingSelection(v2HasRangeSelection.value, selectionPosition.value)) return;
23010
23024
  activeSelection.value = null;
23011
23025
  resetSelection();
23012
23026
  return;
@@ -23300,6 +23314,16 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
23300
23314
  const reason = typeof payload?.reason === "string" && payload.reason.length > 0 ? payload.reason : "open-failed";
23301
23315
  const detail = normalizeV2EditorFailureDetail(payload?.detail);
23302
23316
  const documentId = typeof payload?.documentId === "string" && payload.documentId.length > 0 ? payload.documentId : null;
23317
+ if (reason === "worker-transport-failed") {
23318
+ proxy.$superdoc.emit("exception", {
23319
+ error: /* @__PURE__ */ new Error("Worker transport failed."),
23320
+ code: reason,
23321
+ ...documentId ? { documentId } : {},
23322
+ editor: null,
23323
+ ...payload?.workerFailure ? { workerFailure: payload.workerFailure } : {}
23324
+ });
23325
+ return;
23326
+ }
23303
23327
  const collaborationException = createCollaborationException(reason, documentId);
23304
23328
  const message = collaborationException?.error.message ?? getV2EditorFailureMessage(reason);
23305
23329
  const workerFailure = payload?.workerFailure && typeof payload.workerFailure === "object" ? payload.workerFailure : null;
@@ -24541,7 +24565,7 @@ var SuperDoc_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_v
24541
24565
  ], 38);
24542
24566
  };
24543
24567
  }
24544
- }, [["__scopeId", "data-v-0d8ce95e"]]);
24568
+ }, [["__scopeId", "data-v-99399849"]]);
24545
24569
  //#endregion
24546
24570
  //#region src/core/create-app.js
24547
24571
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46358,7 +46382,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46358
46382
  this.config.colors = shuffleArray(this.config.colors);
46359
46383
  this.userColorMap = /* @__PURE__ */ new Map();
46360
46384
  this.colorIndex = 0;
46361
- this.version = "2.21.0";
46385
+ this.version = "2.22.0-next.10";
46362
46386
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46363
46387
  this.superdocId = config.superdocId || require_uuid.v4();
46364
46388
  this.colors = this.config.colors ?? [];
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM$2 } from "./chunks/rolldown-runtime-0pSA04fp.es.js";
2
2
  import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
- import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, g as recordInteraction, h as isWorkflowRecordingEnabled, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as getWorkflowRecording, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-0CZTlOvl.es.js";
3
+ import { c as createImageFilePicker, d as DOM_CLASS_NAMES, f as closeInteractionHistory, g as recordInteraction, h as isWorkflowRecordingEnabled, i as registerFirstPartyCommandMutation, l as resolveImageSrc, m as getWorkflowRecording, n as executeFirstPartyCommandAsync, o as applyV2CommentInvalidationFromMutation, p as createInteractionHistory, r as readFirstPartyPageNumbers, s as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-Dos1KQcL.es.js";
4
4
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-DEIiXiH2.es.js";
5
5
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
6
6
  import { $ as watch$1, A as onActivated, B as resolveDirective, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRef, H as shallowRef$1, I as reactive, J as useAttrs, K as toRefs, L as ref, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelText, R as renderList, S as isReactive$1, T as mergeProps, U as toDisplayString, V as resolveDynamicComponent, W as toRaw$2, X as vModelCheckbox, Y as useSlots, Z as vModelSelect, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as withCtx, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withKeys, o as createApp, p as createVNode, q as unref, r as Teleport, rt as withModifiers, s as createBlock, t as _plugin_vue_export_helper_default, tt as withDirectives, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderSlot } from "./chunks/_plugin-vue_export-helper-DHiJKCsy.es.js";
@@ -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.21.0";
317
+ return "2.22.0-next.10";
318
318
  } catch {
319
319
  return "unknown";
320
320
  }
@@ -17347,6 +17347,17 @@ var shouldPreserveHostV2Selection = (documentMode, hostSnapshot) => {
17347
17347
  if (documentMode !== "editing" && documentMode !== "suggesting") return false;
17348
17348
  return isV2RangeSnapshot(hostSnapshot);
17349
17349
  };
17350
+ /**
17351
+ * A V2 paint can briefly have no DOM anchor while a selected control is being
17352
+ * rebuilt. Keep an already-positioned comment affordance during that gap when
17353
+ * the host still owns a range; otherwise the button unmounts and remounts on
17354
+ * consecutive paint frames, making it blink and intercepting its own click.
17355
+ *
17356
+ * @param {boolean} hasHostRange
17357
+ * @param {{ source?: unknown } | null | undefined} selectionPosition
17358
+ * @returns {boolean}
17359
+ */
17360
+ var shouldRetainV2FloatingSelection = (hasHostRange, selectionPosition) => hasHostRange === true && selectionPosition?.source === "document-editor";
17350
17361
  //#endregion
17351
17362
  //#region src/composables/use-password-prompt.js
17352
17363
  /** @typedef {import('../core/types').PasswordPromptConfig} PasswordPromptConfig */
@@ -21062,8 +21073,10 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21062
21073
  const { code, reason, severity } = diag;
21063
21074
  if (severity !== "error" && severity !== "warn") return null;
21064
21075
  if (code === "render.exact-content-hydration-failed") return null;
21076
+ const unusableFurniture = code === "render.header-footer.ref-unusable" || code === "render.header-footer.part-unusable";
21065
21077
  let diagnosticCode;
21066
- if (code.includes("page-geometry.failed") || code.includes("section-metadata.failed") || code.includes("page-furniture.failed") || code === "render.provider-error") diagnosticCode = "RENDER_ERROR";
21078
+ if (unusableFurniture) diagnosticCode = "PARSE_ERROR";
21079
+ else if (code.includes("page-geometry.failed") || code.includes("section-metadata.failed") || code.includes("page-furniture.failed") || code === "render.provider-error") diagnosticCode = "RENDER_ERROR";
21067
21080
  else if (code.includes("unsupported")) diagnosticCode = "UNSUPPORTED_FEATURE";
21068
21081
  else if (code.includes("degraded")) diagnosticCode = typeof reason === "string" && (reason.includes("retained ") || reason.includes("localized resolve ")) ? "RENDER_ERROR" : "PERFORMANCE_ERROR";
21069
21082
  else if (severity === "error") diagnosticCode = "RENDER_ERROR";
@@ -21072,7 +21085,7 @@ function translateRenderReadinessDiagnostic(diag, ctx = {}) {
21072
21085
  return {
21073
21086
  error: new Error(message),
21074
21087
  diagnosticCode,
21075
- diagnosticStage: "render",
21088
+ diagnosticStage: unusableFurniture ? "parse" : "render",
21076
21089
  severity,
21077
21090
  internalCode: code,
21078
21091
  documentId: ctx.documentId ?? null,
@@ -22966,6 +22979,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
22966
22979
  }
22967
22980
  const selection = buildV2FloatingSelection();
22968
22981
  if (!selection) {
22982
+ if (shouldRetainV2FloatingSelection(v2HasRangeSelection.value, selectionPosition.value)) return;
22969
22983
  activeSelection.value = null;
22970
22984
  resetSelection();
22971
22985
  return;
@@ -23259,6 +23273,16 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
23259
23273
  const reason = typeof payload?.reason === "string" && payload.reason.length > 0 ? payload.reason : "open-failed";
23260
23274
  const detail = normalizeV2EditorFailureDetail(payload?.detail);
23261
23275
  const documentId = typeof payload?.documentId === "string" && payload.documentId.length > 0 ? payload.documentId : null;
23276
+ if (reason === "worker-transport-failed") {
23277
+ proxy.$superdoc.emit("exception", {
23278
+ error: /* @__PURE__ */ new Error("Worker transport failed."),
23279
+ code: reason,
23280
+ ...documentId ? { documentId } : {},
23281
+ editor: null,
23282
+ ...payload?.workerFailure ? { workerFailure: payload.workerFailure } : {}
23283
+ });
23284
+ return;
23285
+ }
23262
23286
  const collaborationException = createCollaborationException(reason, documentId);
23263
23287
  const message = collaborationException?.error.message ?? getV2EditorFailureMessage(reason);
23264
23288
  const workerFailure = payload?.workerFailure && typeof payload.workerFailure === "object" ? payload.workerFailure : null;
@@ -24500,7 +24524,7 @@ var SuperDoc_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
24500
24524
  ], 38);
24501
24525
  };
24502
24526
  }
24503
- }, [["__scopeId", "data-v-0d8ce95e"]]);
24527
+ }, [["__scopeId", "data-v-99399849"]]);
24504
24528
  //#endregion
24505
24529
  //#region src/core/create-app.js
24506
24530
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -46287,7 +46311,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46287
46311
  this.config.colors = shuffleArray(this.config.colors);
46288
46312
  this.userColorMap = /* @__PURE__ */ new Map();
46289
46313
  this.colorIndex = 0;
46290
- this.version = "2.21.0";
46314
+ this.version = "2.22.0-next.10";
46291
46315
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46292
46316
  this.superdocId = config.superdocId || v4();
46293
46317
  this.colors = this.config.colors ?? [];