superdoc 2.25.0-next.4 → 2.25.0-next.5

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
@@ -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-C-oN_R2a.cjs");
4
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-B-A8sK47.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-BUdjGKyl.cjs");
@@ -304,7 +304,7 @@ var awarenessStatesToArray = (context, states) => {
304
304
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
305
305
  function getSuperdocVersion() {
306
306
  try {
307
- return "2.25.0-next.4";
307
+ return "2.25.0-next.5";
308
308
  } catch {
309
309
  return "unknown";
310
310
  }
@@ -46568,6 +46568,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46568
46568
  return this.#surfacesConfig;
46569
46569
  }
46570
46570
  #surfaceManager;
46571
+ #sourceLifecycleReady;
46572
+ #pendingSourceLifecycle;
46571
46573
  /**
46572
46574
  * SuperDoc-owned editor runtime registry. This is the internal place to ask
46573
46575
  * which mounted editor runtime is active and which runtime owns a DOM event
@@ -46640,6 +46642,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46640
46642
  this.whiteboard = null;
46641
46643
  this.colors = [];
46642
46644
  this.readyEditors = 0;
46645
+ this.#sourceLifecycleReady = false;
46646
+ this.#pendingSourceLifecycle = [];
46643
46647
  this.#editorRuntimeRegistry = new EditorRuntimeRegistry();
46644
46648
  this.#editorRuntimeRegistryUnsub = null;
46645
46649
  this.#applyingRuntimeActiveChange = false;
@@ -46793,7 +46797,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46793
46797
  }
46794
46798
  this.userColorMap = /* @__PURE__ */ new Map();
46795
46799
  this.colorIndex = 0;
46796
- this.version = "2.25.0-next.4";
46800
+ this.version = "2.25.0-next.5";
46797
46801
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46798
46802
  this.superdocId = config.superdocId || require_uuid.v4();
46799
46803
  this.colors = this.config.colors ?? [];
@@ -46830,6 +46834,8 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
46830
46834
  * Mount the Vue app, stores, and editor runtime.
46831
46835
  */
46832
46836
  #startRuntime() {
46837
+ this.#sourceLifecycleReady = false;
46838
+ this.#pendingSourceLifecycle = [];
46833
46839
  this.#initVueApp();
46834
46840
  this.readyEditors = 0;
46835
46841
  if (!this.app) throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");
@@ -47865,7 +47871,13 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
47865
47871
  * Triggered when the superdoc is ready
47866
47872
  */
47867
47873
  broadcastReady() {
47868
- if (this.readyEditors === this.requiredNumberOfEditors) this.emit("ready", { superdoc: this });
47874
+ if (this.#destroyed) return;
47875
+ if (this.readyEditors === this.requiredNumberOfEditors) {
47876
+ this.emit("ready", { superdoc: this });
47877
+ if (this.#destroyed) return;
47878
+ this.#sourceLifecycleReady = true;
47879
+ for (const type of this.#pendingSourceLifecycle.splice(0)) this.emit(type);
47880
+ }
47869
47881
  }
47870
47882
  /**
47871
47883
  * Triggered before an editor is created
@@ -47884,11 +47896,19 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
47884
47896
  this.#wireFontsChangedRelay(editor);
47885
47897
  this.emit("editorCreate", { editor: createDeprecatedEditorProxy(editor) });
47886
47898
  }
47899
+ #broadcastSourceLifecycle(type) {
47900
+ if (this.#destroyed) return;
47901
+ if (!this.#sourceLifecycleReady) {
47902
+ this.#pendingSourceLifecycle.push(type);
47903
+ return;
47904
+ }
47905
+ this.emit(type);
47906
+ }
47887
47907
  broadcastSourceComplete() {
47888
- this.emit("source:complete");
47908
+ this.#broadcastSourceLifecycle("source:complete");
47889
47909
  }
47890
47910
  broadcastSourceSignalsComplete() {
47891
- this.emit("source:signals-complete");
47911
+ this.#broadcastSourceLifecycle("source:signals-complete");
47892
47912
  }
47893
47913
  /** Editors whose `fonts-changed` we already relay, so a repeated create wires once. */
47894
47914
  #fontsRelayEditors;
@@ -49150,6 +49170,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
49150
49170
  destroy() {
49151
49171
  require_create_super_doc_ui.closeInteractionHistory(this);
49152
49172
  this.#destroyed = true;
49173
+ this.#pendingSourceLifecycle = [];
49153
49174
  this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
49154
49175
  this.#contentControlClickRoot?.removeEventListener("pointerdown", this.#handleContentControlPointerDown, true);
49155
49176
  this.#contentControlClickRoot?.ownerDocument.removeEventListener("pointerup", this.#handleContentControlPointerEnd, true);
@@ -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-D5waZHl3.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-CrH79xw6.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 vModelText, A as onActivated, B as renderSlot, C as isRef$1, D as normalizeClass, E as nextTick, F as openBlock, G as toRaw$2, H as resolveDynamicComponent, I as provide$1, J as unref, K as toRef, L as reactive, M as onDeactivated, N as onMounted, O as normalizeProps, P as onScopeDispose$1, Q as vModelSelect, R as ref, S as isReactive$1, T as mergeProps, U as shallowRef$1, V as resolveDirective, W as toDisplayString, X as useSlots, Y as useAttrs, Z as vModelCheckbox, _ as getCurrentInstance, a as computed$1, b as hasInjectionContext, c as createCommentVNode, d as createStaticVNode, et as watch$1, f as createTextVNode, g as effectScope, h as defineComponent, i as Transition, it as withModifiers, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, m as defineAsyncComponent, n as Fragment, nt as withDirectives, o as createApp, p as createVNode, q as toRefs, r as Teleport, rt as withKeys, s as createBlock, t as _plugin_vue_export_helper_default, tt as withCtx, u as createElementVNode, v as getCurrentScope, w as markRaw, x as inject$1, y as h, z as renderList } from "./chunks/_plugin-vue_export-helper-7ZiLY07t.es.js";
@@ -302,7 +302,7 @@ var awarenessStatesToArray = (context, states) => {
302
302
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
303
303
  function getSuperdocVersion() {
304
304
  try {
305
- return "2.25.0-next.4";
305
+ return "2.25.0-next.5";
306
306
  } catch {
307
307
  return "unknown";
308
308
  }
@@ -46497,6 +46497,8 @@ var SuperDoc = class extends import_eventemitter3.default {
46497
46497
  return this.#surfacesConfig;
46498
46498
  }
46499
46499
  #surfaceManager;
46500
+ #sourceLifecycleReady;
46501
+ #pendingSourceLifecycle;
46500
46502
  /**
46501
46503
  * SuperDoc-owned editor runtime registry. This is the internal place to ask
46502
46504
  * which mounted editor runtime is active and which runtime owns a DOM event
@@ -46569,6 +46571,8 @@ var SuperDoc = class extends import_eventemitter3.default {
46569
46571
  this.whiteboard = null;
46570
46572
  this.colors = [];
46571
46573
  this.readyEditors = 0;
46574
+ this.#sourceLifecycleReady = false;
46575
+ this.#pendingSourceLifecycle = [];
46572
46576
  this.#editorRuntimeRegistry = new EditorRuntimeRegistry();
46573
46577
  this.#editorRuntimeRegistryUnsub = null;
46574
46578
  this.#applyingRuntimeActiveChange = false;
@@ -46722,7 +46726,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46722
46726
  }
46723
46727
  this.userColorMap = /* @__PURE__ */ new Map();
46724
46728
  this.colorIndex = 0;
46725
- this.version = "2.25.0-next.4";
46729
+ this.version = "2.25.0-next.5";
46726
46730
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46727
46731
  this.superdocId = config.superdocId || v4();
46728
46732
  this.colors = this.config.colors ?? [];
@@ -46759,6 +46763,8 @@ var SuperDoc = class extends import_eventemitter3.default {
46759
46763
  * Mount the Vue app, stores, and editor runtime.
46760
46764
  */
46761
46765
  #startRuntime() {
46766
+ this.#sourceLifecycleReady = false;
46767
+ this.#pendingSourceLifecycle = [];
46762
46768
  this.#initVueApp();
46763
46769
  this.readyEditors = 0;
46764
46770
  if (!this.app) throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");
@@ -47794,7 +47800,13 @@ var SuperDoc = class extends import_eventemitter3.default {
47794
47800
  * Triggered when the superdoc is ready
47795
47801
  */
47796
47802
  broadcastReady() {
47797
- if (this.readyEditors === this.requiredNumberOfEditors) this.emit("ready", { superdoc: this });
47803
+ if (this.#destroyed) return;
47804
+ if (this.readyEditors === this.requiredNumberOfEditors) {
47805
+ this.emit("ready", { superdoc: this });
47806
+ if (this.#destroyed) return;
47807
+ this.#sourceLifecycleReady = true;
47808
+ for (const type of this.#pendingSourceLifecycle.splice(0)) this.emit(type);
47809
+ }
47798
47810
  }
47799
47811
  /**
47800
47812
  * Triggered before an editor is created
@@ -47813,11 +47825,19 @@ var SuperDoc = class extends import_eventemitter3.default {
47813
47825
  this.#wireFontsChangedRelay(editor);
47814
47826
  this.emit("editorCreate", { editor: createDeprecatedEditorProxy(editor) });
47815
47827
  }
47828
+ #broadcastSourceLifecycle(type) {
47829
+ if (this.#destroyed) return;
47830
+ if (!this.#sourceLifecycleReady) {
47831
+ this.#pendingSourceLifecycle.push(type);
47832
+ return;
47833
+ }
47834
+ this.emit(type);
47835
+ }
47816
47836
  broadcastSourceComplete() {
47817
- this.emit("source:complete");
47837
+ this.#broadcastSourceLifecycle("source:complete");
47818
47838
  }
47819
47839
  broadcastSourceSignalsComplete() {
47820
- this.emit("source:signals-complete");
47840
+ this.#broadcastSourceLifecycle("source:signals-complete");
47821
47841
  }
47822
47842
  /** Editors whose `fonts-changed` we already relay, so a repeated create wires once. */
47823
47843
  #fontsRelayEditors;
@@ -49079,6 +49099,7 @@ var SuperDoc = class extends import_eventemitter3.default {
49079
49099
  destroy() {
49080
49100
  closeInteractionHistory(this);
49081
49101
  this.#destroyed = true;
49102
+ this.#pendingSourceLifecycle = [];
49082
49103
  this.#contentControlClickRoot?.removeEventListener("click", this.#handleContentControlClick, true);
49083
49104
  this.#contentControlClickRoot?.removeEventListener("pointerdown", this.#handleContentControlPointerDown, true);
49084
49105
  this.#contentControlClickRoot?.ownerDocument.removeEventListener("pointerup", this.#handleContentControlPointerEnd, true);