@fileverse-dev/dsheet 4.0.6 → 4.1.1-edit-mode-14

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 (48) hide show
  1. package/dist/editor/components/editor-workbook-controls.d.ts +11 -0
  2. package/dist/editor/components/editor-workbook-controls.test.d.ts +1 -0
  3. package/dist/editor/components/editor-workbook.d.ts +5 -1
  4. package/dist/editor/components/permission-chip-model.d.ts +34 -0
  5. package/dist/editor/components/permission-chip.d.ts +5 -1
  6. package/dist/editor/components/permission-chip.test.d.ts +1 -0
  7. package/dist/editor/contexts/editor-context.d.ts +11 -2
  8. package/dist/editor/dsheet-editor.d.ts +3 -2
  9. package/dist/editor/hooks/collaboration-lifecycle.d.ts +35 -0
  10. package/dist/editor/hooks/collaboration-lifecycle.test.d.ts +1 -0
  11. package/dist/editor/hooks/use-collab-awareness.d.ts +3 -6
  12. package/dist/editor/hooks/use-editor-data.d.ts +2 -2
  13. package/dist/editor/hooks/use-editor-sync.d.ts +6 -2
  14. package/dist/editor/types.d.ts +29 -3
  15. package/dist/editor/utils/detach-workbook-data.d.ts +8 -0
  16. package/dist/editor/utils/detach-workbook-data.test.d.ts +1 -0
  17. package/dist/editor/utils/editor-handle.d.ts +11 -0
  18. package/dist/editor/utils/editor-handle.test.d.ts +1 -0
  19. package/dist/{index-CQUhZB3J.js → index-DzwlrPIa.js} +19873 -18770
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.es.js +52 -48
  22. package/dist/persistence-utils-BXFajzvq.js +98 -0
  23. package/dist/persistence-utils.d.ts +6 -0
  24. package/dist/persistence-utils.test.d.ts +1 -0
  25. package/dist/persistence.js +1 -1
  26. package/dist/sheet-engine/react/components/Toolbar/index.d.ts +1 -0
  27. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  28. package/dist/style.css +1 -1
  29. package/dist/sync-local/SyncManager.d.ts +54 -9
  30. package/dist/sync-local/crypto/room-key.d.ts +2 -0
  31. package/dist/sync-local/crypto/room-key.test.d.ts +1 -0
  32. package/dist/sync-local/floor.d.ts +8 -0
  33. package/dist/sync-local/floor.test.d.ts +1 -0
  34. package/dist/sync-local/index.d.ts +1 -1
  35. package/dist/sync-local/presence.d.ts +11 -0
  36. package/dist/sync-local/presence.test.d.ts +1 -0
  37. package/dist/sync-local/session-tools.d.ts +31 -0
  38. package/dist/sync-local/session-tools.test.d.ts +1 -0
  39. package/dist/sync-local/socketClient.d.ts +74 -8
  40. package/dist/sync-local/types/index.d.ts +111 -15
  41. package/dist/sync-local/useSyncManager.d.ts +4 -0
  42. package/dist/{use-xlsx-import-impl-DNTnmzDN.js → use-xlsx-import-impl-CeDHNaXi.js} +3 -3
  43. package/dist/{xlsx-defined-names-BHxDk83p.js → xlsx-defined-names-CPlC1afa.js} +1 -1
  44. package/dist/{xlsx-export-impl-r3bDoVjv.js → xlsx-export-impl-SyIbZKQB.js} +3 -3
  45. package/dist/{xlsx-hyperlink-inline-B5IR_SOR.js → xlsx-hyperlink-inline-Ch9f11g5.js} +1 -1
  46. package/package.json +6 -4
  47. package/dist/persistence-utils-DsM_MOB1.js +0 -89
  48. package/dist/sync-local/utils/objectToFile.d.ts +0 -1
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, } from './editor/types/comments';
10
10
  export { CommentAction } from './editor/types/comments';
@@ -16,6 +16,8 @@ export type { SmartContractConfig, SmartContractEvent, SmartContractEventType, C
16
16
  export { SupportedChain } from './editor/types/smart-contract';
17
17
  export type { WorkbookInstance } from './sheet-engine/react';
18
18
  export type { CollaborationProps, CollabConnectionConfig, CollabSessionMeta, CollabServices, CollabCallbacks, CollabState, CollabStatus, CollabError, CollabErrorCode, CollabUser, } from './sync-local/types';
19
+ export { fetchSessionState, seedSession } from './sync-local/session-tools';
20
+ export { encryptForRoomKey, decryptForRoomKey, } from './sync-local/crypto/room-key';
19
21
  export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from './editor/constants/shared-constants';
20
22
  export { TEMPLATES } from '@fileverse-dev/dsheets-templates/template-metadata-list';
21
23
  export { handleCSVUpload } from './editor/utils/csv-import';
package/dist/index.es.js CHANGED
@@ -1,59 +1,63 @@
1
- import { C as s, d as t, f as o, S as r, g as l, h as d, j as n, T as i, k as S, l as c, n as h, o as m, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A as I, B as f, D as w, E as A, F as L, G as T, H as v, I as D, J as M } from "./index-CQUhZB3J.js";
2
- import { cw as k, cx as V, cy as y, cE as z, bq as G, e as P, f as U, l as X, a as _, dg as j, dh as B, b9 as H, di as O, dj as q, dn as J, dp as K, dr as N, I as Y, dG as Z, ed as Q, b2 as W } from "./executeStringFunction-CxsiamWG.js";
3
- import { FLVURL as ee } from "@fileverse-dev/formulajs";
4
- import { E as se, S as te } from "./constants-CRFfbkoQ.js";
1
+ import { C as s, d as o, f as t, S as r, g as l, h as d, j as n, T as i, k as S, l as c, n as h, o as m, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A as f, B as I, D as L, E as w, F as A, G as y, H as T, I as v, J as M, K as D, L as b, M as k, N as V } from "./index-DzwlrPIa.js";
2
+ import { cw as G, cx as K, cy as P, cE as U, bq as X, e as _, f as j, l as B, a as H, dg as O, dh as q, b9 as J, di as N, dj as Y, dn as Z, dp as Q, dr as W, I as $, dG as ee, ed as ae, b2 as se } from "./executeStringFunction-CxsiamWG.js";
3
+ import { FLVURL as te } from "@fileverse-dev/formulajs";
4
+ import { E as le, S as de } from "./constants-CRFfbkoQ.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
- se as ERROR_MESSAGES_FLAG,
12
- ee as FLVURL,
11
+ le as ERROR_MESSAGES_FLAG,
12
+ te as FLVURL,
13
13
  d as FortuneCore,
14
- te as SERVICES_API_KEY,
14
+ de as SERVICES_API_KEY,
15
15
  n as SupportedChain,
16
16
  i as TEMPLATES,
17
17
  S as api,
18
- k as clearColumnsCellsFormat,
18
+ G as clearColumnsCellsFormat,
19
19
  c as clearFilter,
20
- V as clearRowsCellsFormat,
21
- y as clearSelectedCellFormat,
20
+ K as clearRowsCellsFormat,
21
+ P as clearSelectedCellFormat,
22
22
  h as createFilter,
23
- z as deleteRowCol,
24
- G as deleteSelectedCellText,
25
- m as describeMatchedShortcut,
26
- P as executeStringFunction,
27
- U as formulaResponseUiSync,
28
- X as getFlowdata,
29
- p as getRemoveDuplicatesErrorMessage,
30
- C as getRemoveDuplicatesPreview,
31
- _ as getSheetIndex,
32
- u as handleCSVUpload,
33
- E as handleCopy,
34
- F as handleExportToCSV,
35
- g as handleExportToJSON,
36
- x as handleExportToXLSX,
37
- j as handleFreeze,
38
- B as handleHorizontalAlign,
39
- H as handleLink,
40
- O as handleMerge,
41
- R as handlePasteByClick,
42
- q as handleSort,
43
- J as handleTextSize,
44
- K as handleVerticalAlign,
45
- I as importSpreadsheetFile,
46
- N as insertRowCol,
47
- f as isBrowserZoomShortcut,
48
- w as isFormulaListShortcut,
49
- A as isOpenShortcutsModalShortcut,
50
- Y as jfrefreshgrid,
51
- Z as loadLocale,
52
- L as removeActiveImage,
53
- T as removeDuplicates,
54
- v as showImgChooser,
55
- Q as toolbarItemClickHandler,
56
- W as updateFormat,
57
- D as useEnsStatus,
58
- M as useXLSXImport
23
+ m 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
+ E as getRemoveDuplicatesErrorMessage,
33
+ F as getRemoveDuplicatesPreview,
34
+ H as getSheetIndex,
35
+ g as handleCSVUpload,
36
+ x as handleCopy,
37
+ R as handleExportToCSV,
38
+ f as handleExportToJSON,
39
+ I as handleExportToXLSX,
40
+ O as handleFreeze,
41
+ q as handleHorizontalAlign,
42
+ J as handleLink,
43
+ N as handleMerge,
44
+ L as handlePasteByClick,
45
+ Y as handleSort,
46
+ Z as handleTextSize,
47
+ Q as handleVerticalAlign,
48
+ w as importSpreadsheetFile,
49
+ W as insertRowCol,
50
+ A as isBrowserZoomShortcut,
51
+ y as isFormulaListShortcut,
52
+ T as isOpenShortcutsModalShortcut,
53
+ $ as jfrefreshgrid,
54
+ ee as loadLocale,
55
+ v as removeActiveImage,
56
+ M as removeDuplicates,
57
+ D as seedSession,
58
+ b as showImgChooser,
59
+ ae as toolbarItemClickHandler,
60
+ se as updateFormat,
61
+ k as useEnsStatus,
62
+ V as useXLSXImport
59
63
  };
@@ -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<{