@fileverse-dev/dsheet 4.1.15-a → 4.1.16

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/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as s, d as o, f as t, S as r, g as l, h as n, j as d, T as S, k as c, l as i, n as m, o as h, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A, B as f, D as I, E as L, F as T, G as w, H as y, I as v, J as D, K as M, L as b, M as k, N as z, O, P } from "./index-NOS7ASys.js";
1
+ import { C as s, d as o, f as t, S as r, g as l, h as n, j as d, T as S, k as c, l as i, n as m, o as h, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A, B as f, D as I, E as L, F as T, G as w, H as y, I as v, J as D, K as M, L as b, M as k, N as z, O, P } from "./index-DV7neprH.js";
2
2
  import { cy as G, cz as K, cA as U, cG as X, bs as _, e as j, f as B, l as H, a as J, dj as N, dk as q, bb as Y, dl as Z, dm as Q, dr as W, ds as $, du as ee, I as ae, dJ as se, eg as oe, b4 as te } from "./executeStringFunction-B1_kGelH.js";
3
3
  import { FLVURL as le } from "@fileverse-dev/formulajs";
4
4
  import { E as de, S as Se } from "./constants-8Ij49Lxv.js";
@@ -0,0 +1,98 @@
1
+ import * as i from "yjs";
2
+ const p = typeof Buffer == "function";
3
+ typeof TextDecoder == "function" && new TextDecoder();
4
+ typeof TextEncoder == "function" && new TextEncoder();
5
+ const A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", c = Array.prototype.slice.call(A), f = ((t) => {
6
+ let e = {};
7
+ return t.forEach((r, n) => e[r] = n), e;
8
+ })(c), b = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, u = String.fromCharCode.bind(String), d = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), E = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), g = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), S = (t) => {
9
+ let e, r, n, o, a = "";
10
+ const s = t.length % 3;
11
+ for (let l = 0; l < t.length; ) {
12
+ if ((r = t.charCodeAt(l++)) > 255 || (n = t.charCodeAt(l++)) > 255 || (o = t.charCodeAt(l++)) > 255)
13
+ throw new TypeError("invalid character found");
14
+ e = r << 16 | n << 8 | o, a += c[e >> 18 & 63] + c[e >> 12 & 63] + c[e >> 6 & 63] + c[e & 63];
15
+ }
16
+ return s ? a.slice(0, s - 3) + "===".substring(s) : a;
17
+ }, U = typeof btoa == "function" ? (t) => btoa(t) : p ? (t) => Buffer.from(t, "binary").toString("base64") : S, y = p ? (t) => Buffer.from(t).toString("base64") : (t) => {
18
+ let r = [];
19
+ for (let n = 0, o = t.length; n < o; n += 4096)
20
+ r.push(u.apply(null, t.subarray(n, n + 4096)));
21
+ return U(r.join(""));
22
+ }, h = (t, e = !1) => e ? E(y(t)) : y(t), _ = (t) => {
23
+ if (t = t.replace(/\s+/g, ""), !b.test(t))
24
+ throw new TypeError("malformed base64.");
25
+ t += "==".slice(2 - (t.length & 3));
26
+ let e, r, n, o = [];
27
+ for (let a = 0; a < t.length; )
28
+ e = f[t.charAt(a++)] << 18 | f[t.charAt(a++)] << 12 | (r = f[t.charAt(a++)]) << 6 | (n = f[t.charAt(a++)]), r === 64 ? o.push(u(e >> 16 & 255)) : n === 64 ? o.push(u(e >> 16 & 255, e >> 8 & 255)) : o.push(u(e >> 16 & 255, e >> 8 & 255, e & 255));
29
+ return o.join("");
30
+ }, w = typeof atob == "function" ? (t) => atob(g(t)) : p ? (t) => Buffer.from(t, "base64").toString("binary") : _, D = p ? (t) => d(Buffer.from(t, "base64")) : (t) => d(w(t).split("").map((e) => e.charCodeAt(0))), T = (t) => D(C(t)), C = (t) => g(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), v = 8e3, x = (t) => t instanceof Error ? t : new Error(String(t)), B = (t, e, r = "dsheet-package-ingress") => {
31
+ const n = T(e), o = new i.Doc();
32
+ try {
33
+ i.applyUpdate(o, n);
34
+ } finally {
35
+ o.destroy();
36
+ }
37
+ let a = !1;
38
+ const s = () => {
39
+ a = !0;
40
+ };
41
+ t.on("update", s);
42
+ try {
43
+ return i.applyUpdate(t, n, r), a;
44
+ } finally {
45
+ t.off("update", s);
46
+ }
47
+ }, z = async (t, e) => {
48
+ let r;
49
+ try {
50
+ return await Promise.race([
51
+ t,
52
+ new Promise((n, o) => {
53
+ r = setTimeout(
54
+ () => o(new Error("dSheet IndexedDB operation timed out")),
55
+ e
56
+ );
57
+ })
58
+ ]);
59
+ } finally {
60
+ r && clearTimeout(r);
61
+ }
62
+ }, m = (t, e, r) => ({
63
+ dsheetId: t,
64
+ status: e,
65
+ encodedState: null,
66
+ stateVector: null,
67
+ ...r ? { error: x(r) } : {}
68
+ }), P = (t, e) => {
69
+ const r = i.encodeStateAsUpdate(e);
70
+ return {
71
+ dsheetId: t,
72
+ status: r.length <= 2 ? "empty" : "available",
73
+ encodedState: h(r),
74
+ stateVector: h(i.encodeStateVector(e))
75
+ };
76
+ }, Z = (t, e, r) => {
77
+ if (!r)
78
+ return m(
79
+ t,
80
+ "unavailable",
81
+ new Error("dSheet document is not ready")
82
+ );
83
+ try {
84
+ return B(r, e, "dsheet-package-ingress"), P(t, r);
85
+ } catch (n) {
86
+ return m(t, "corrupt", n);
87
+ }
88
+ };
89
+ export {
90
+ v as D,
91
+ Z as a,
92
+ h as f,
93
+ B as m,
94
+ P as s,
95
+ T as t,
96
+ m as u,
97
+ z as w
98
+ };
@@ -1,124 +1,118 @@
1
- import { t as D, f as g, D as b, u as p, w as S, c as v, s as w } from "./persistence-compaction-D4Wox9k_.js";
1
+ import { t as D, f as h, D as b, u as p, w as S, s as w } from "./persistence-utils-BXFajzvq.js";
2
2
  import * as u from "yjs";
3
- import { clearDocument as x, IndexeddbPersistence as E } from "y-indexeddb";
4
- const f = /* @__PURE__ */ new Map(), A = (e) => {
5
- const a = new u.Doc();
3
+ import { clearDocument as v, IndexeddbPersistence as E } from "y-indexeddb";
4
+ const f = /* @__PURE__ */ new Map(), M = (e) => {
5
+ const o = new u.Doc();
6
6
  try {
7
7
  return u.applyUpdate(
8
- a,
8
+ o,
9
9
  typeof e == "string" ? D(e) : e
10
- ), g(u.encodeStateVector(a));
10
+ ), h(u.encodeStateVector(o));
11
11
  } finally {
12
- a.destroy();
12
+ o.destroy();
13
13
  }
14
- }, B = (e, a) => new Promise((c) => {
15
- const s = new u.Doc();
16
- let r = null, t = null, o = !1, y = !1;
17
- const m = (n) => {
18
- o || (o = !0, clearTimeout(h), r == null || r.close(), s.destroy(), c(n));
19
- }, i = (n, d) => m(p(e, n, d)), h = setTimeout(() => {
14
+ }, x = (e, o) => new Promise((s) => {
15
+ const a = new u.Doc();
16
+ let r = null, t = null, i = !1, m = !1;
17
+ const y = (n) => {
18
+ i || (i = !0, clearTimeout(g), r == null || r.close(), a.destroy(), s(n));
19
+ }, c = (n, d) => y(p(e, n, d)), g = setTimeout(() => {
20
20
  try {
21
21
  t == null || t.abort();
22
22
  } catch {
23
23
  }
24
- i("timed-out", new Error("dSheet IndexedDB read timed out"));
25
- }, a);
24
+ c("timed-out", new Error("dSheet IndexedDB read timed out"));
25
+ }, o);
26
26
  let l;
27
27
  try {
28
28
  l = indexedDB.open(e);
29
29
  } catch (n) {
30
- i("unavailable", n);
30
+ c("unavailable", n);
31
31
  return;
32
32
  }
33
33
  l.onupgradeneeded = () => {
34
34
  var n;
35
- y = !0, (n = l.transaction) == null || n.abort();
35
+ m = !0, (n = l.transaction) == null || n.abort();
36
36
  }, l.onerror = () => {
37
- y ? m(p(e, "missing")) : i("unavailable", l.error);
37
+ m ? y(p(e, "missing")) : c("unavailable", l.error);
38
38
  }, l.onsuccess = () => {
39
39
  if (r = l.result, !r.objectStoreNames.contains("updates") || !r.objectStoreNames.contains("custom")) {
40
- i("corrupt", new Error("dSheet IndexedDB schema is invalid"));
40
+ c("corrupt", new Error("dSheet IndexedDB schema is invalid"));
41
41
  return;
42
42
  }
43
43
  try {
44
44
  t = r.transaction("updates", "readonly");
45
45
  const n = t.objectStore("updates").getAll();
46
- n.onerror = () => i("unavailable", n.error), n.onsuccess = () => {
46
+ n.onerror = () => c("unavailable", n.error), n.onsuccess = () => {
47
47
  try {
48
48
  for (const d of n.result ?? []) {
49
49
  if (!(d instanceof Uint8Array))
50
50
  throw new Error("dSheet IndexedDB contains a non-Yjs update");
51
- u.applyUpdate(s, d);
51
+ u.applyUpdate(a, d);
52
52
  }
53
53
  } catch (d) {
54
- i("corrupt", d);
54
+ c("corrupt", d);
55
55
  }
56
- }, t.oncomplete = () => m(w(e, s)), t.onabort = () => {
57
- o || i("unavailable", t == null ? void 0 : t.error);
56
+ }, t.oncomplete = () => y(w(e, a)), t.onabort = () => {
57
+ i || c("unavailable", t == null ? void 0 : t.error);
58
58
  }, t.onerror = () => {
59
- o || i("unavailable", t == null ? void 0 : t.error);
59
+ i || c("unavailable", t == null ? void 0 : t.error);
60
60
  };
61
61
  } catch (n) {
62
- i("unavailable", n);
62
+ c("unavailable", n);
63
63
  }
64
64
  };
65
- }), T = async (e, a) => {
65
+ }), B = async (e, o) => {
66
66
  if (typeof indexedDB > "u")
67
67
  return p(
68
68
  e,
69
69
  "unavailable",
70
70
  new Error("IndexedDB is unavailable")
71
71
  );
72
- const c = indexedDB;
73
- if (c.databases)
72
+ const s = indexedDB;
73
+ if (s.databases)
74
74
  try {
75
- if (!(await c.databases()).some((r) => r.name === e))
75
+ if (!(await s.databases()).some((r) => r.name === e))
76
76
  return p(e, "missing");
77
77
  } catch {
78
78
  }
79
- return B(e, a);
80
- }, C = (e, a = {}) => {
81
- const c = f.get(e);
82
- if (c) return c;
83
- const s = T(
79
+ return x(e, o);
80
+ }, A = (e, o = {}) => {
81
+ const s = f.get(e);
82
+ if (s) return s;
83
+ const a = B(
84
84
  e,
85
- a.timeoutMs ?? b
85
+ o.timeoutMs ?? b
86
86
  ).finally(() => {
87
- f.get(e) === s && f.delete(e);
87
+ f.get(e) === a && f.delete(e);
88
88
  });
89
- return f.set(e, s), s;
90
- }, P = async (e, a, c = {}) => {
91
- const s = c.timeoutMs ?? b, r = new u.Doc();
89
+ return f.set(e, a), a;
90
+ }, C = async (e, o, s = {}) => {
91
+ const a = s.timeoutMs ?? b, r = new u.Doc();
92
92
  try {
93
- u.applyUpdate(r, D(a), "dsheet-package-ingress");
94
- } catch (o) {
95
- return r.destroy(), p(e, "corrupt", o);
93
+ u.applyUpdate(r, D(o), "dsheet-package-ingress");
94
+ } catch (i) {
95
+ return r.destroy(), p(e, "corrupt", i);
96
96
  }
97
97
  let t = null;
98
98
  try {
99
- t = new E(e, r), await S(t.whenSynced, s);
100
- try {
101
- await v(t);
102
- } catch (o) {
103
- console.warn("[DSheet] IndexedDB compaction failed:", o);
104
- }
105
- return w(e, r);
106
- } catch (o) {
99
+ return t = new E(e, r), await S(t.whenSynced, a), w(e, r);
100
+ } catch (i) {
107
101
  return p(
108
102
  e,
109
- /timed out/i.test(String(o)) ? "timed-out" : "unavailable",
110
- o
103
+ /timed out/i.test(String(i)) ? "timed-out" : "unavailable",
104
+ i
111
105
  );
112
106
  } finally {
113
107
  await (t == null ? void 0 : t.destroy().catch(() => {
114
108
  })), r.destroy();
115
109
  }
116
110
  }, j = async (e) => {
117
- f.delete(e), typeof indexedDB < "u" && await x(e);
111
+ f.delete(e), typeof indexedDB < "u" && await v(e);
118
112
  };
119
113
  export {
120
114
  j as deleteDsheetContent,
121
- A as getDsheetStateVector,
122
- P as mergeDsheetContent,
123
- C as readDsheetContent
115
+ M as getDsheetStateVector,
116
+ C as mergeDsheetContent,
117
+ A as readDsheetContent
124
118
  };
@@ -1,9 +1,10 @@
1
- import { default as React } from 'react';
1
+ import { default as React, CSSProperties } from 'react';
2
2
 
3
3
  type Props = {
4
4
  tooltip: string;
5
5
  iconId?: string;
6
6
  text?: string;
7
+ textStyle?: CSSProperties;
7
8
  showArrow?: boolean;
8
9
  onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
9
10
  children: (setOpen: React.Dispatch<React.SetStateAction<boolean>>) => React.ReactNode;
@@ -1,10 +1,10 @@
1
1
  import * as BZ from "yjs";
2
- import { i as Yl, a as hl, s as eZ, r as ul, y as Il, b as pl, m as Rl } from "./index-NOS7ASys.js";
2
+ import { i as Yl, a as hl, s as eZ, r as ul, y as Il, b as pl, m as Rl } from "./index-DV7neprH.js";
3
3
  import { g as sl } from "./executeStringFunction-B1_kGelH.js";
4
4
  import { Workbook as al } from "exceljs";
5
5
  import Kl from "luckyexcel";
6
- import { e as Jl, b as xl, n as Ml } from "./xlsx-hyperlink-inline-xYQhsbfe.js";
7
- import { parseDefinedNamesFromXlsxBuffer as Sl, excelEntriesToDefinedNames as OZ } from "./xlsx-defined-names-DeoJwvXV.js";
6
+ import { e as Jl, b as xl, n as Ml } from "./xlsx-hyperlink-inline-Ds-KIXU2.js";
7
+ import { parseDefinedNamesFromXlsxBuffer as Sl, excelEntriesToDefinedNames as OZ } from "./xlsx-defined-names-DpMQs9x_.js";
8
8
  import { toast as fZ } from "@fileverse/ui";
9
9
  var Zl = { exports: {} };
10
10
  (function(m) {
@@ -1,5 +1,5 @@
1
1
  import { i as w } from "./executeStringFunction-B1_kGelH.js";
2
- import { J as x } from "./xlsx-hyperlink-inline-xYQhsbfe.js";
2
+ import { J as x } from "./xlsx-hyperlink-inline-Ds-KIXU2.js";
3
3
  function g(o) {
4
4
  return o.startsWith("_xlnm.");
5
5
  }
@@ -1,9 +1,9 @@
1
1
  import { utils as S, write as nt } from "xlsx-js-style";
2
2
  import { Workbook as pt } from "exceljs";
3
3
  import { toast as rt } from "@fileverse/ui";
4
- import { J as dt, c as X, g as ht, a as mt } from "./xlsx-hyperlink-inline-xYQhsbfe.js";
4
+ import { J as dt, c as X, g as ht, a as mt } from "./xlsx-hyperlink-inline-Ds-KIXU2.js";
5
5
  import { b as gt } from "./executeStringFunction-B1_kGelH.js";
6
- import { e as bt } from "./index-NOS7ASys.js";
6
+ import { e as bt } from "./index-DV7neprH.js";
7
7
  const xt = {
8
8
  1: "thin",
9
9
  2: "hair",
@@ -854,7 +854,7 @@ const Z = (t) => {
854
854
  O
855
855
  );
856
856
  });
857
- const { applyDefinedNamesToExcelWorkbook: ct } = await import("./xlsx-defined-names-DeoJwvXV.js");
857
+ const { applyDefinedNamesToExcelWorkbook: ct } = await import("./xlsx-defined-names-DpMQs9x_.js");
858
858
  ct(
859
859
  B,
860
860
  (k = (C = (s = t.current).getWorkbookContext) == null ? void 0 : C.call(s)) == null ? void 0 : k.definedNames,
@@ -1,5 +1,5 @@
1
1
  import { g as Rt, c as yt } from "./executeStringFunction-B1_kGelH.js";
2
- import { c as wt } from "./index-NOS7ASys.js";
2
+ import { c as wt } from "./index-DV7neprH.js";
3
3
  function jt(J, nt) {
4
4
  const g = J.getImages();
5
5
  if (!g.length) return [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "4.1.15-a",
5
+ "version": "4.1.16",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/fileverse/fileverse-dsheets.git"
@@ -93,7 +93,7 @@
93
93
  "vite-plugin-dts": "^3.6.3",
94
94
  "xlsx": "^0.18.5",
95
95
  "xlsx-js-style": "^1.2.0",
96
- "y-indexeddb": "~9.0.12",
96
+ "y-indexeddb": "^9.0.12",
97
97
  "y-protocols": "^1.0.6"
98
98
  },
99
99
  "peerDependencies": {
@@ -133,4 +133,4 @@
133
133
  "vitest": "^3.2.4",
134
134
  "yjs": "13.6.30"
135
135
  }
136
- }
136
+ }
@@ -1,130 +0,0 @@
1
- import * as l from "yjs";
2
- const y = typeof Buffer == "function";
3
- typeof TextDecoder == "function" && new TextDecoder();
4
- typeof TextEncoder == "function" && new TextEncoder();
5
- const B = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", u = Array.prototype.slice.call(B), f = ((t) => {
6
- let e = {};
7
- return t.forEach((r, o) => e[r] = o), e;
8
- })(u), P = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, d = String.fromCharCode.bind(String), S = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), R = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), D = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), v = (t) => {
9
- let e, r, o, n, a = "";
10
- const s = t.length % 3;
11
- for (let c = 0; c < t.length; ) {
12
- if ((r = t.charCodeAt(c++)) > 255 || (o = t.charCodeAt(c++)) > 255 || (n = t.charCodeAt(c++)) > 255)
13
- throw new TypeError("invalid character found");
14
- e = r << 16 | o << 8 | n, a += u[e >> 18 & 63] + u[e >> 12 & 63] + u[e >> 6 & 63] + u[e & 63];
15
- }
16
- return s ? a.slice(0, s - 3) + "===".substring(s) : a;
17
- }, z = typeof btoa == "function" ? (t) => btoa(t) : y ? (t) => Buffer.from(t, "binary").toString("base64") : v, E = y ? (t) => Buffer.from(t).toString("base64") : (t) => {
18
- let r = [];
19
- for (let o = 0, n = t.length; o < n; o += 4096)
20
- r.push(d.apply(null, t.subarray(o, o + 4096)));
21
- return z(r.join(""));
22
- }, U = (t, e = !1) => e ? R(E(t)) : E(t), k = (t) => {
23
- if (t = t.replace(/\s+/g, ""), !P.test(t))
24
- throw new TypeError("malformed base64.");
25
- t += "==".slice(2 - (t.length & 3));
26
- let e, r, o, n = [];
27
- for (let a = 0; a < t.length; )
28
- e = f[t.charAt(a++)] << 18 | f[t.charAt(a++)] << 12 | (r = f[t.charAt(a++)]) << 6 | (o = f[t.charAt(a++)]), r === 64 ? n.push(d(e >> 16 & 255)) : o === 64 ? n.push(d(e >> 16 & 255, e >> 8 & 255)) : n.push(d(e >> 16 & 255, e >> 8 & 255, e & 255));
29
- return n.join("");
30
- }, I = typeof atob == "function" ? (t) => atob(D(t)) : y ? (t) => Buffer.from(t, "base64").toString("binary") : k, Z = y ? (t) => S(Buffer.from(t, "base64")) : (t) => S(I(t).split("").map((e) => e.charCodeAt(0))), j = (t) => Z(q(t)), q = (t) => D(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), O = 8e3, K = (t) => t instanceof Error ? t : new Error(String(t)), V = (t, e, r = "dsheet-package-ingress") => {
31
- const o = j(e), n = new l.Doc();
32
- try {
33
- l.applyUpdate(n, o);
34
- } finally {
35
- n.destroy();
36
- }
37
- let a = !1;
38
- const s = () => {
39
- a = !0;
40
- };
41
- t.on("update", s);
42
- try {
43
- return l.applyUpdate(t, o, r), a;
44
- } finally {
45
- t.off("update", s);
46
- }
47
- }, F = async (t, e) => {
48
- let r;
49
- try {
50
- return await Promise.race([
51
- t,
52
- new Promise((o, n) => {
53
- r = setTimeout(
54
- () => n(new Error("dSheet IndexedDB operation timed out")),
55
- e
56
- );
57
- })
58
- ]);
59
- } finally {
60
- r && clearTimeout(r);
61
- }
62
- }, _ = (t, e, r) => ({
63
- dsheetId: t,
64
- status: e,
65
- encodedState: null,
66
- stateVector: null,
67
- ...r ? { error: K(r) } : {}
68
- }), M = (t, e) => {
69
- const r = l.encodeStateAsUpdate(e);
70
- return {
71
- dsheetId: t,
72
- status: r.length <= 2 ? "empty" : "available",
73
- encodedState: U(r),
74
- stateVector: U(l.encodeStateVector(e))
75
- };
76
- }, H = (t, e, r) => {
77
- if (!r)
78
- return _(
79
- t,
80
- "unavailable",
81
- new Error("dSheet document is not ready")
82
- );
83
- try {
84
- return V(r, e, "dsheet-package-ingress"), M(t, r);
85
- } catch (o) {
86
- return _(t, "corrupt", o);
87
- }
88
- }, h = "updates", N = (t, e) => l.mergeUpdates([t, ...e]), L = async (t, e = 2) => {
89
- if (t._destroyed) return 0;
90
- await t.whenSynced;
91
- const r = t.db;
92
- return !r || !r.objectStoreNames.contains(h) ? 0 : await new Promise((n, a) => {
93
- const s = r.transaction(h, "readwrite"), c = s.objectStore(h);
94
- let m = 0, p = -1;
95
- const g = c.getAllKeys();
96
- g.onsuccess = () => {
97
- const i = g.result;
98
- if (i.length < e) return;
99
- const b = c.getAll();
100
- b.onsuccess = () => {
101
- const A = b.result.filter(
102
- (x) => x instanceof Uint8Array
103
- );
104
- if (A.length !== i.length) return;
105
- const T = N(
106
- l.encodeStateAsUpdate(t.doc),
107
- A
108
- ), C = i[i.length - 1];
109
- c.delete(IDBKeyRange.upperBound(C)), c.add(T), m = i.length;
110
- const w = c.count();
111
- w.onsuccess = () => {
112
- p = w.result;
113
- };
114
- };
115
- }, s.oncomplete = () => {
116
- p >= 0 && typeof t._dbsize == "number" && (t._dbsize = p), n(m);
117
- }, s.onerror = () => a(s.error), s.onabort = () => a(s.error ?? new Error("compaction aborted"));
118
- });
119
- };
120
- export {
121
- O as D,
122
- H as a,
123
- L as c,
124
- U as f,
125
- V as m,
126
- M as s,
127
- j as t,
128
- _ as u,
129
- F as w
130
- };
@@ -1,25 +0,0 @@
1
- import { IndexeddbPersistence } from 'y-indexeddb';
2
-
3
- /**
4
- * Merges the live doc state with the rows already in the store.
5
- *
6
- * Order matters: when two inputs cover the same struct, Y.mergeUpdates keeps
7
- * the FIRST one. The live doc already holds deleted cells as GC'd structs,
8
- * while old rows still carry their full content. Putting the doc state first
9
- * lets the GC'd version win, so bloated stores actually shrink. Rows only add
10
- * what this doc has never seen (e.g. writes from another tab).
11
- */
12
- export declare const mergeStoredRows: (docState: Uint8Array, rows: Uint8Array[]) => Uint8Array;
13
- /**
14
- * y-indexeddb appends a FULL copy of the doc every time a provider is attached
15
- * to a Y.Doc that already holds content, and only trims after 500 rows. dSheet
16
- * attaches to pre-filled docs on every open (published content, remote merges),
17
- * so the store grows by one full copy per open and every load replays them all.
18
- *
19
- * This collapses the store into a single row. It runs in ONE readwrite
20
- * transaction and merges every stored row (not just this provider's doc), so
21
- * rows written by another tab/provider in the meantime are never lost.
22
- *
23
- * Returns the number of rows removed (0 when nothing needed compacting).
24
- */
25
- export declare const compactDsheetPersistence: (persistence: IndexeddbPersistence, minRows?: number) => Promise<number>;
@@ -1 +0,0 @@
1
- export {};