@fileverse-dev/dsheet 4.1.2 → 4.1.4

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/{constants-CRFfbkoQ.js → constants-8Ij49Lxv.js} +79 -22
  3. package/dist/constants.d.ts +2 -2
  4. package/dist/constants.js +3 -3
  5. package/dist/crypto-constants-CY-Whjwy.js +333 -0
  6. package/dist/editor/components/editor-workbook-controls.d.ts +11 -0
  7. package/dist/editor/components/editor-workbook-controls.test.d.ts +1 -0
  8. package/dist/editor/components/editor-workbook.d.ts +5 -1
  9. package/dist/editor/components/permission-chip-model.d.ts +34 -0
  10. package/dist/editor/components/permission-chip.d.ts +5 -1
  11. package/dist/editor/components/permission-chip.test.d.ts +1 -0
  12. package/dist/editor/contexts/editor-context.d.ts +11 -2
  13. package/dist/editor/dsheet-editor.d.ts +3 -2
  14. package/dist/editor/hooks/collaboration-lifecycle.d.ts +35 -0
  15. package/dist/editor/hooks/collaboration-lifecycle.test.d.ts +1 -0
  16. package/dist/editor/hooks/use-collab-awareness.d.ts +3 -6
  17. package/dist/editor/hooks/use-editor-data.d.ts +2 -2
  18. package/dist/editor/hooks/use-editor-sync.d.ts +6 -2
  19. package/dist/editor/types.d.ts +29 -3
  20. package/dist/editor/utils/detach-workbook-data.d.ts +8 -0
  21. package/dist/editor/utils/detach-workbook-data.test.d.ts +1 -0
  22. package/dist/editor/utils/editor-handle.d.ts +11 -0
  23. package/dist/editor/utils/editor-handle.test.d.ts +1 -0
  24. package/dist/{executeStringFunction-BhS7NspU.js → executeStringFunction-adhsb5GH.js} +1 -1
  25. package/dist/formula.js +1 -1
  26. package/dist/{index-CufCBExa.js → index-CRzwkPJq.js} +28208 -28025
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.es.js +55 -51
  29. package/dist/persistence-utils-BXFajzvq.js +98 -0
  30. package/dist/persistence-utils.d.ts +6 -0
  31. package/dist/persistence-utils.test.d.ts +1 -0
  32. package/dist/persistence.js +1 -1
  33. package/dist/sheet-engine/react/components/Toolbar/index.d.ts +1 -0
  34. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  35. package/dist/style.css +1 -1
  36. package/dist/sync-local/SyncManager.d.ts +54 -9
  37. package/dist/sync-local/crypto/room-key.d.ts +2 -0
  38. package/dist/sync-local/crypto/room-key.test.d.ts +1 -0
  39. package/dist/sync-local/floor.d.ts +8 -0
  40. package/dist/sync-local/floor.test.d.ts +1 -0
  41. package/dist/sync-local/index.d.ts +1 -1
  42. package/dist/sync-local/presence.d.ts +13 -0
  43. package/dist/sync-local/presence.test.d.ts +1 -0
  44. package/dist/sync-local/session-tools.d.ts +31 -0
  45. package/dist/sync-local/session-tools.test.d.ts +1 -0
  46. package/dist/sync-local/socketClient.d.ts +75 -8
  47. package/dist/sync-local/types/index.d.ts +111 -15
  48. package/dist/sync-local/useSyncManager.d.ts +4 -0
  49. package/dist/template-data-list-ahkAKadB.js +117921 -0
  50. package/dist/{use-xlsx-import-impl-BrpzMELW.js → use-xlsx-import-impl-tzKWGisi.js} +4 -4
  51. package/dist/{xlsx-defined-names-DR03Ea-E.js → xlsx-defined-names-CflXuPTO.js} +2 -2
  52. package/dist/{xlsx-export-impl-wJaTTBGt.js → xlsx-export-impl-CkJLfQwm.js} +4 -4
  53. package/dist/{xlsx-hyperlink-inline-53h_A_BI.js → xlsx-hyperlink-inline-DWLdqDYy.js} +2 -2
  54. package/package.json +3 -3
  55. package/dist/crypto-constants-ZTlAYRUf.js +0 -1165
  56. package/dist/persistence-utils-DsM_MOB1.js +0 -89
  57. package/dist/sync-local/utils/objectToFile.d.ts +0 -1
  58. package/dist/template-data-list-RKnVLsuf.js +0 -502876
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { formulaResponseUiSync } from './editor/utils/formula-ui-sync';
4
4
  export { executeStringFunction } from './editor/utils/executeStringFunction';
5
5
  export { FLVURL } from '@fileverse-dev/formulajs';
6
6
  export { loadLocale } from './sheet-engine/core';
7
- export type { ErrorMessageHandlerReturnType, DataBlockEvent, DataBlockEventType, ApiKeyStorage } from './editor/types';
7
+ export type { ErrorMessageHandlerReturnType, DataBlockEvent, DataBlockEventType, ApiKeyStorage, DSheetEditorHandle, DSheetPermissionMode, } from './editor/types';
8
8
  export type { PanelConfig, PanelId, BuiltInPanelType } from './editor/types';
9
9
  export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, CommentAnchorMove, } from './editor/types/comments';
10
10
  export { CommentAction } from './editor/types/comments';
@@ -17,6 +17,8 @@ export type { SmartContractConfig, SmartContractEvent, SmartContractEventType, C
17
17
  export { SupportedChain } from './editor/types/smart-contract';
18
18
  export type { WorkbookInstance } from './sheet-engine/react';
19
19
  export type { CollaborationProps, CollabConnectionConfig, CollabSessionMeta, CollabServices, CollabCallbacks, CollabState, CollabStatus, CollabError, CollabErrorCode, CollabUser, } from './sync-local/types';
20
+ export { fetchSessionState, seedSession } from './sync-local/session-tools';
21
+ export { encryptForRoomKey, decryptForRoomKey, } from './sync-local/crypto/room-key';
20
22
  export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from './editor/constants/shared-constants';
21
23
  export { TEMPLATES } from '@fileverse-dev/dsheets-templates/template-metadata-list';
22
24
  export { handleCSVUpload } from './editor/utils/csv-import';
package/dist/index.es.js CHANGED
@@ -1,60 +1,64 @@
1
- import { C as s, d as t, f as o, S as r, g as l, h as n, j as d, T as i, k as c, l as S, 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 A, A as I, B as R, D as f, E as L, F as w, G as T, H as v, I as b, J as k, K as D } from "./index-CufCBExa.js";
2
- import { cy as z, cz as V, cA as y, cG as G, bs as P, e as U, f as X, l as _, a as j, di as B, dj as H, bb as O, dk as q, dl as J, dq as K, dr as N, dt as Y, I as Z, dI as Q, ef as W, b4 as $ } from "./executeStringFunction-BhS7NspU.js";
3
- import { FLVURL as ae } from "@fileverse-dev/formulajs";
4
- import { E as te, S as oe } from "./constants-CRFfbkoQ.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 c, k as i, l as S, n as m, o as h, p, q as C, t as u, u as F, v as E, w as g, x as R, z as x, A as f, B as A, D as I, E as L, F as w, G as y, H as T, I as v, J as M, K as b, L as k, M as D, N as z, O as V } from "./index-CRzwkPJq.js";
2
+ import { cy as K, cz as O, cA as P, cG as U, bs as X, e as _, f as j, l as B, a as H, di as q, dj as J, bb as N, dk as Y, dl as Z, dq as Q, dr as W, dt as $, I as ee, dI as ae, ef as se, b4 as oe } from "./executeStringFunction-adhsb5GH.js";
3
+ import { FLVURL as re } from "@fileverse-dev/formulajs";
4
+ import { E as ne, S as de } from "./constants-8Ij49Lxv.js";
5
5
  export {
6
6
  s as CommentAction,
7
- t as CommentCellUI,
8
- o as CommentsContent,
7
+ o as CommentCellUI,
8
+ t as CommentsContent,
9
9
  r as DSheetEditor,
10
10
  l as DSheetSkeleton,
11
- te as ERROR_MESSAGES_FLAG,
12
- ae as FLVURL,
11
+ ne as ERROR_MESSAGES_FLAG,
12
+ re as FLVURL,
13
13
  n as FortuneCore,
14
- oe as SERVICES_API_KEY,
14
+ de as SERVICES_API_KEY,
15
15
  d as SupportedChain,
16
- i as TEMPLATES,
17
- c as api,
18
- z as clearColumnsCellsFormat,
16
+ c as TEMPLATES,
17
+ i as api,
18
+ K as clearColumnsCellsFormat,
19
19
  S as clearFilter,
20
- V as clearRowsCellsFormat,
21
- y as clearSelectedCellFormat,
20
+ O as clearRowsCellsFormat,
21
+ P as clearSelectedCellFormat,
22
22
  m as createFilter,
23
- G as deleteRowCol,
24
- P as deleteSelectedCellText,
25
- h as describeMatchedShortcut,
26
- U as executeStringFunction,
27
- X as formulaResponseUiSync,
28
- _ as getFlowdata,
29
- p as getRemoveDuplicatesErrorMessage,
30
- C as getRemoveDuplicatesPreview,
31
- j as getSheetIndex,
32
- u as handleCSVUpload,
33
- E as handleCopy,
34
- F as handleExportToCSV,
35
- g as handleExportToJSON,
36
- x as handleExportToXLSX,
37
- B as handleFreeze,
38
- H as handleHorizontalAlign,
39
- O as handleLink,
40
- q as handleMerge,
41
- A as handlePasteByClick,
42
- J as handleSort,
43
- K as handleTextSize,
44
- N as handleVerticalAlign,
45
- I as importSpreadsheetFile,
46
- Y as insertRowCol,
47
- R as isBrowserZoomShortcut,
48
- f as isFormulaListShortcut,
49
- L as isOpenShortcutsModalShortcut,
50
- Z as jfrefreshgrid,
51
- Q as loadLocale,
52
- w as remapCommentAnchors,
53
- T as removeActiveImage,
54
- v as removeDuplicates,
55
- b as showImgChooser,
56
- W as toolbarItemClickHandler,
57
- $ as updateFormat,
58
- k as useEnsStatus,
59
- D as useXLSXImport
23
+ h as decryptForRoomKey,
24
+ U as deleteRowCol,
25
+ X as deleteSelectedCellText,
26
+ p as describeMatchedShortcut,
27
+ C as encryptForRoomKey,
28
+ _ as executeStringFunction,
29
+ u as fetchSessionState,
30
+ j as formulaResponseUiSync,
31
+ B as getFlowdata,
32
+ F as getRemoveDuplicatesErrorMessage,
33
+ E as getRemoveDuplicatesPreview,
34
+ H as getSheetIndex,
35
+ g as handleCSVUpload,
36
+ R as handleCopy,
37
+ x as handleExportToCSV,
38
+ f as handleExportToJSON,
39
+ A as handleExportToXLSX,
40
+ q as handleFreeze,
41
+ J as handleHorizontalAlign,
42
+ N as handleLink,
43
+ Y as handleMerge,
44
+ I as handlePasteByClick,
45
+ Z as handleSort,
46
+ Q as handleTextSize,
47
+ W as handleVerticalAlign,
48
+ L as importSpreadsheetFile,
49
+ $ as insertRowCol,
50
+ w as isBrowserZoomShortcut,
51
+ y as isFormulaListShortcut,
52
+ T as isOpenShortcutsModalShortcut,
53
+ ee as jfrefreshgrid,
54
+ ae as loadLocale,
55
+ v as remapCommentAnchors,
56
+ M as removeActiveImage,
57
+ b as removeDuplicates,
58
+ k as seedSession,
59
+ D as showImgChooser,
60
+ se as toolbarItemClickHandler,
61
+ oe as updateFormat,
62
+ z as useEnsStatus,
63
+ V as useXLSXImport
60
64
  };
@@ -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
+ };
@@ -11,6 +11,12 @@ export type DSheetContentSnapshot = {
11
11
  export type DSheetContentReadOptions = {
12
12
  timeoutMs?: number;
13
13
  };
14
+ /**
15
+ * Apply a full dSheet artifact without rebuilding its shared types. Keeping the
16
+ * original Yjs structs is required for independently bootstrapped peers to
17
+ * converge instead of inserting duplicate workbook data.
18
+ */
19
+ export declare const mergeDsheetEncodedContent: (doc: Y.Doc, encodedState: string, origin?: unknown) => boolean;
14
20
  export declare const withDsheetPersistenceTimeout: <T>(promise: Promise<T>, timeoutMs: number) => Promise<T>;
15
21
  export declare const unavailableDsheetContentSnapshot: (dsheetId: string, status: Exclude<DSheetContentStatus, "available" | "empty">, error?: unknown) => DSheetContentSnapshot;
16
22
  export declare const snapshotDsheetDocument: (dsheetId: string, doc: Y.Doc) => DSheetContentSnapshot;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { t as D, f as h, D as b, u as p, w as S, s as w } from "./persistence-utils-DsM_MOB1.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
3
  import { clearDocument as v, IndexeddbPersistence as E } from "y-indexeddb";
4
4
  const f = /* @__PURE__ */ new Map(), M = (e) => {
@@ -12,5 +12,6 @@ declare const Toolbar: React.FC<{
12
12
  moreItemsOpen: boolean;
13
13
  onMoreToolbarItemsClose?: () => void;
14
14
  moreToolbarItems?: React.ReactNode;
15
+ trailingContent?: React.ReactNode;
15
16
  }>;
16
17
  export default Toolbar;
@@ -12,6 +12,7 @@ type AdditionalProps = {
12
12
  sidebarActivePanel?: string | null;
13
13
  sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
14
14
  sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
15
+ toolbarTrailingContent?: React.ReactNode;
15
16
  theme?: ThemeKey;
16
17
  };
17
18
  declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalProps & React.RefAttributes<{