@fileverse-dev/dsheet 2.0.36-rtc-8 → 2.0.36-rtc-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.
@@ -45642,6 +45642,11 @@ class lS {
45642
45642
  sessionDid: (t = this.collaborationKeyPair) == null ? void 0 : t.did()
45643
45643
  };
45644
45644
  await this._emitWithAck("/documents/terminate", o);
45645
+ } catch (n) {
45646
+ console.warn(
45647
+ "[SocketClient] /documents/terminate failed — disconnected locally",
45648
+ n
45649
+ );
45645
45650
  } finally {
45646
45651
  this.disconnect();
45647
45652
  }
@@ -46091,6 +46096,8 @@ class uS {
46091
46096
  Te(this, "uncommittedUpdatesIdList", []);
46092
46097
  Te(this, "contentTobeAppliedQueue", []);
46093
46098
  Te(this, "isProcessing", !1);
46099
+ /** Prevents parallel terminateSession calls (UI + effect cleanup). */
46100
+ Te(this, "_terminating", !1);
46094
46101
  Te(this, "flushTimer", null);
46095
46102
  Te(this, "FLUSH_INTERVAL_MS", 50);
46096
46103
  Te(this, "MAX_QUEUE_SIZE", 5);
@@ -46178,16 +46185,24 @@ class uS {
46178
46185
  }
46179
46186
  async terminateSession() {
46180
46187
  var t, n;
46181
- if (this._status !== "idle") {
46182
- await this.awaitFlush();
46188
+ if (!(this._status === "idle" || this._terminating)) {
46189
+ this._terminating = !0;
46183
46190
  try {
46184
- this._awareness && $o(
46185
- this._awareness,
46186
- [this.ydoc.clientID],
46187
- "session terminated"
46188
- ), this.isOwner ? await ((t = this.socketClient) == null ? void 0 : t.terminateSession()) : (n = this.socketClient) == null || n.disconnect();
46191
+ await this.awaitFlush();
46192
+ try {
46193
+ this._awareness && $o(
46194
+ this._awareness,
46195
+ [this.ydoc.clientID],
46196
+ "session terminated"
46197
+ ), this.isOwner ? await ((t = this.socketClient) == null ? void 0 : t.terminateSession()) : (n = this.socketClient) == null || n.disconnect();
46198
+ } catch (o) {
46199
+ console.warn(
46200
+ "[SyncManager] terminateSession socket step failed (local cleanup continues)",
46201
+ o
46202
+ );
46203
+ }
46189
46204
  } finally {
46190
- this.resetInternalState(), this.send({
46205
+ this._terminating = !1, this.resetInternalState(), this.send({
46191
46206
  type: "SESSION_TERMINATED",
46192
46207
  reason: "User terminated session"
46193
46208
  }), this.send({ type: "RESET" });
@@ -46710,7 +46725,12 @@ const fS = { status: "idle" }, dS = (e) => {
46710
46725
  ), l = Ee(() => {
46711
46726
  r.disconnect();
46712
46727
  }, [r]), f = Ee(() => {
46713
- r.terminateSession();
46728
+ r.terminateSession().catch((p) => {
46729
+ console.warn(
46730
+ "useSyncManager: terminateSession failed (session reset locally)",
46731
+ p
46732
+ );
46733
+ });
46714
46734
  }, [r]), c = t.status === "syncing", d = t.status === "ready" && !!a, h = t.status === "ready" || t.status === "reconnecting";
46715
46735
  return {
46716
46736
  state: t,
@@ -49978,7 +49998,8 @@ const Pg = Wg(void 0), YA = ({
49978
49998
  !p || !p.name || l.push({
49979
49999
  clientId: h,
49980
50000
  name: p.name,
49981
- color: p.color || "#3DA5F4"
50001
+ color: p.color || "#3DA5F4",
50002
+ isEns: p.isEns ?? !1
49982
50003
  });
49983
50004
  });
49984
50005
  const f = l.map((d) => `${d.clientId}:${d.name}:${d.color}`).sort().join("|");
@@ -50600,7 +50621,7 @@ const Er = ({
50600
50621
  }, w.readAsText(h);
50601
50622
  });
50602
50623
  }, G0 = async (e, t, n, o) => {
50603
- const { handleExportToXLSX: r } = await import("./xlsx-export-impl-CRw27cg1.js");
50624
+ const { handleExportToXLSX: r } = await import("./xlsx-export-impl-Df--S5zo.js");
50604
50625
  return r(e, t, n, o);
50605
50626
  }, uN = (e) => {
50606
50627
  var n;
@@ -50675,7 +50696,7 @@ const Er = ({
50675
50696
  const [a, i] = Ie(!1);
50676
50697
  return { handleXLSXUpload: Ee(
50677
50698
  async (f, c, d) => {
50678
- const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-Cu-q8lC5.js");
50699
+ const { runXlsxFileUpload: h } = await import("./use-xlsx-import-impl-B1zexYKE.js");
50679
50700
  return h(
50680
50701
  {
50681
50702
  sheetEditorRef: e,
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as s, a as l, i as o, T as t, b as r, d as n, e as d, h as S, f as h, g as i, j as c, k as m, l as C, n as p, o as E, p as x, q as F, r as g, s as R, t as f, u as L, v as b, w as u, x as T, z as A } from "./index-CpskXdSI.js";
1
+ import { S as s, a as l, i as o, T as t, b as r, d as n, e as d, h as S, f as h, g as i, j as c, k as m, l as C, n as p, o as E, p as x, q as F, r as g, s as R, t as f, u as L, v as b, w as u, x as T, z as A } from "./index-BPpCmYwh.js";
2
2
  import { bL as w, bM as k, bN as V, bR as z, bb as M, e as X, f as _, h as j, a as v, cc as y, aq as P, cj as U } from "./executeStringFunction-F9mb-SpN.js";
3
3
  import { FLVURL as D } from "@fileverse-dev/formulajs";
4
4
  import { E as H, S as N } from "./constants-yStXQJiK.js";
@@ -14,6 +14,8 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ /** Prevents parallel terminateSession calls (UI + effect cleanup). */
18
+ private _terminating;
17
19
  private flushTimer;
18
20
  private readonly FLUSH_INTERVAL_MS;
19
21
  private readonly MAX_QUEUE_SIZE;
@@ -3,6 +3,7 @@ export interface CollabUser {
3
3
  clientId: number;
4
4
  name: string;
5
5
  color: string;
6
+ isEns: boolean;
6
7
  cell?: {
7
8
  r: number;
8
9
  c: number;
@@ -1,6 +1,6 @@
1
1
  import { g as Ue } from "./executeStringFunction-F9mb-SpN.js";
2
2
  import * as qe from "yjs";
3
- import { m as Xe, y as Ze } from "./index-CpskXdSI.js";
3
+ import { m as Xe, y as Ze } from "./index-BPpCmYwh.js";
4
4
  import { n as Je } from "./xlsx-hyperlink-inline-DzewAypN.js";
5
5
  import { toast as Be } from "@fileverse/ui";
6
6
  var We = { exports: {} };
@@ -3,7 +3,7 @@ import { Workbook as Pt } from "exceljs";
3
3
  import { toast as Ut } from "@fileverse/ui";
4
4
  import { addFortuneImagesToWorksheet as Lt } from "./xlsx-image-utils-Cvg0qxRA.js";
5
5
  import { g as jt, c as xt } from "./executeStringFunction-F9mb-SpN.js";
6
- import { c as Ct } from "./index-CpskXdSI.js";
6
+ import { c as Ct } from "./index-BPpCmYwh.js";
7
7
  import { c as zt, g as Wt } from "./xlsx-hyperlink-inline-DzewAypN.js";
8
8
  const Mt = {
9
9
  1: "thin",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "2.0.36-rtc-8",
5
+ "version": "2.0.36-rtc-10",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -109,4 +109,4 @@
109
109
  "typescript": "^5.2.2",
110
110
  "vite": "^5.0.0"
111
111
  }
112
- }
112
+ }