@fileverse-dev/dsheet 2.1.5 → 3.0.1-formula-1

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 (132) hide show
  1. package/dist/{constants-yStXQJiK.js → constants-Cdz6oSCq.js} +5 -7
  2. package/dist/constants.js +1 -1
  3. package/dist/editor/components/api-key-modal/api-key-input.d.ts +5 -0
  4. package/dist/editor/components/api-key-modal/api-key-modal.d.ts +7 -0
  5. package/dist/editor/components/api-key-modal/rate-limit-info.d.ts +4 -0
  6. package/dist/editor/components/comments/comment-actions-dropdown.d.ts +19 -0
  7. package/dist/editor/components/comments/comment-cell-popup.d.ts +4 -0
  8. package/dist/editor/components/comments/comment-input.d.ts +4 -0
  9. package/dist/editor/components/comments/comment-item.d.ts +4 -0
  10. package/dist/editor/components/comments/comment-sidebar-empty.d.ts +4 -0
  11. package/dist/editor/components/comments/comment-sidebar.d.ts +4 -0
  12. package/dist/editor/components/comments/ens/ens-cache.d.ts +10 -0
  13. package/dist/editor/components/comments/ens/use-ens-status.d.ts +10 -0
  14. package/dist/editor/components/comments/use-comment-cell-popup.d.ts +12 -0
  15. package/dist/editor/components/comments/use-comment-permissions.d.ts +15 -0
  16. package/dist/editor/components/editor-workbook-sync.d.ts +1 -1
  17. package/dist/editor/components/editor-workbook.d.ts +11 -17
  18. package/dist/editor/components/sidebar/editor-right-sidebar.d.ts +20 -0
  19. package/dist/editor/components/sidebar/right-sidebar.d.ts +14 -0
  20. package/dist/editor/components/sidebar/sidebar-context.d.ts +17 -0
  21. package/dist/editor/components/sidebar/sidebar-portal-registry.d.ts +20 -0
  22. package/dist/editor/components/sidebar/use-right-panels.d.ts +12 -0
  23. package/dist/editor/components/sidebars/conditional-format.d.ts +2 -0
  24. package/dist/editor/components/sidebars/data-verification.d.ts +2 -0
  25. package/dist/editor/components/sidebars/function/function-categories-logic.d.ts +11 -0
  26. package/dist/editor/components/sidebars/function/function-categories.d.ts +6 -0
  27. package/dist/editor/components/sidebars/function/function-metadata.d.ts +7 -0
  28. package/dist/editor/components/sidebars/function/functionList.d.ts +8 -0
  29. package/dist/editor/components/sidebars/function/types.d.ts +24 -0
  30. package/dist/editor/components/sidebars/function/use-functions.d.ts +20 -0
  31. package/dist/editor/components/sidebars/function-content.d.ts +8 -0
  32. package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
  33. package/dist/editor/components/sidebars/template-ui.d.ts +22 -0
  34. package/dist/editor/components/sidebars/templates.d.ts +9 -0
  35. package/dist/editor/components/smart-contract/error-toast.d.ts +11 -0
  36. package/dist/editor/components/smart-contract/modal/abi-input-section.d.ts +11 -0
  37. package/dist/editor/components/smart-contract/modal/contract-name-section.d.ts +13 -0
  38. package/dist/editor/components/smart-contract/modal/file-upload-section.d.ts +12 -0
  39. package/dist/editor/components/smart-contract/modal/import-section.d.ts +8 -0
  40. package/dist/editor/components/smart-contract/modal/modal-header.d.ts +17 -0
  41. package/dist/editor/components/smart-contract/smart-contract-list-item.d.ts +8 -0
  42. package/dist/editor/components/smart-contract/smart-contract-modal-ui.d.ts +33 -0
  43. package/dist/editor/components/smart-contract/smart-contract-modal.d.ts +12 -0
  44. package/dist/editor/components/smart-contract/smart-contract-reading-intro.d.ts +4 -0
  45. package/dist/editor/components/smart-contract/smart-contract-view-list.d.ts +6 -0
  46. package/dist/editor/components/smart-contract/use-address-validation.d.ts +5 -0
  47. package/dist/editor/components/smart-contract/use-modal-outside-click.d.ts +18 -0
  48. package/dist/editor/components/smart-contract/use-smart-contract-modal.d.ts +38 -0
  49. package/dist/editor/constants/shared-constants.d.ts +0 -2
  50. package/dist/editor/contexts/editor-context.d.ts +20 -5
  51. package/dist/editor/dsheet-editor.d.ts +1 -1
  52. package/dist/editor/hooks/live-query/use-live-query.d.ts +4 -2
  53. package/dist/editor/hooks/use-celldata-compaction.d.ts +23 -0
  54. package/dist/editor/hooks/use-editor-data.d.ts +4 -2
  55. package/dist/editor/hooks/use-smart-contract.d.ts +26 -0
  56. package/dist/editor/hooks/use-xlsx-import-impl.d.ts +8 -1
  57. package/dist/editor/hooks/use-xlsx-import.d.ts +2 -1
  58. package/dist/editor/types/comments.d.ts +134 -0
  59. package/dist/editor/types/smart-contract.d.ts +88 -0
  60. package/dist/editor/types.d.ts +39 -32
  61. package/dist/editor/utils/after-update-cell.d.ts +13 -8
  62. package/dist/editor/utils/api-key-storage.d.ts +6 -0
  63. package/dist/editor/utils/api-keys-local-storage.d.ts +19 -0
  64. package/dist/editor/utils/cell-comment-marker.d.ts +30 -0
  65. package/dist/editor/utils/comment-key-utils.d.ts +7 -0
  66. package/dist/editor/utils/compact-committed-celldata.d.ts +28 -0
  67. package/dist/editor/utils/config-ydoc-update.d.ts +20 -0
  68. package/dist/editor/utils/csv-import.d.ts +3 -1
  69. package/dist/editor/utils/data-block-error-handler.d.ts +21 -0
  70. package/dist/editor/utils/datablock-error-utils.d.ts +1 -0
  71. package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
  72. package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
  73. package/dist/editor/utils/smart-contract/constants.d.ts +488 -0
  74. package/dist/editor/utils/smart-contract/error-helper.d.ts +20 -0
  75. package/dist/editor/utils/smart-contract/helpers.d.ts +4 -0
  76. package/dist/editor/utils/smart-contract/reading-utils.d.ts +34 -0
  77. package/dist/editor/utils/smart-contract/signature-utils.d.ts +9 -0
  78. package/dist/editor/utils/spreadsheet-import.d.ts +12 -0
  79. package/dist/editor/utils/update-ydoc.d.ts +2 -2
  80. package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
  81. package/dist/executeStringFunction-DMPoSj5F.js +32826 -0
  82. package/dist/formula.js +1 -1
  83. package/dist/index-DAVuAF9T.js +55303 -0
  84. package/dist/index.d.ts +11 -1
  85. package/dist/index.es.js +55 -49
  86. package/dist/jszip.min-CEyB-71x.js +2319 -0
  87. package/dist/sheet-engine/core/api/cell.d.ts +0 -20
  88. package/dist/sheet-engine/core/api/common.d.ts +2 -1
  89. package/dist/sheet-engine/core/api/index.d.ts +1 -0
  90. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +17 -0
  91. package/dist/sheet-engine/core/api/sheet.d.ts +5 -0
  92. package/dist/sheet-engine/core/context.d.ts +8 -1
  93. package/dist/sheet-engine/core/index.d.ts +2 -2
  94. package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +53 -0
  95. package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
  96. package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
  97. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +51 -0
  98. package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
  99. package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +17 -0
  100. package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +24 -0
  101. package/dist/sheet-engine/core/modules/formula.d.ts +53 -1
  102. package/dist/sheet-engine/core/modules/index.d.ts +5 -2
  103. package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
  104. package/dist/sheet-engine/core/modules/sheet-metadata-hooks.d.ts +4 -0
  105. package/dist/sheet-engine/core/modules/sheet.d.ts +17 -1
  106. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +23 -0
  107. package/dist/sheet-engine/core/settings.d.ts +3 -1
  108. package/dist/sheet-engine/core/theme.d.ts +67 -0
  109. package/dist/sheet-engine/core/types.d.ts +20 -0
  110. package/dist/sheet-engine/core/utils/border-config-utils.d.ts +16 -0
  111. package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +10 -0
  112. package/dist/sheet-engine/core/utils/range-format.d.ts +71 -0
  113. package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +40 -0
  114. package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
  115. package/dist/sheet-engine/react/components/SheetOverlay/Icon.d.ts +5 -4
  116. package/dist/sheet-engine/react/components/SheetOverlay/LucideIcon.d.ts +4 -4
  117. package/dist/sheet-engine/react/components/SidebarPanelPortals/index.d.ts +17 -0
  118. package/dist/sheet-engine/react/components/Workbook/api.d.ts +8 -1
  119. package/dist/sheet-engine/react/components/Workbook/index.d.ts +11 -1
  120. package/dist/sheet-engine/react/components/index.d.ts +1 -0
  121. package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
  122. package/dist/style.css +1 -1
  123. package/dist/use-xlsx-import-impl-DzthrhwA.js +1595 -0
  124. package/dist/xlsx-defined-names-D2KoICbm.js +117 -0
  125. package/dist/xlsx-export-impl-b2z4De4f.js +818 -0
  126. package/package.json +6 -4
  127. package/dist/executeStringFunction-BkmJj04p.js +0 -27295
  128. package/dist/index-Drl8OuI3.js +0 -52659
  129. package/dist/sheet-engine/react/components/Toolbar/conditionalFormatPortal.d.ts +0 -7
  130. package/dist/sheet-engine/react/components/Toolbar/dataVerificationPortal.d.ts +0 -6
  131. package/dist/use-xlsx-import-impl-DC_BfAcT.js +0 -1527
  132. package/dist/xlsx-export-impl-DP_eK3zS.js +0 -3126
@@ -0,0 +1,19 @@
1
+ export declare const INVALID_KEY_MARKER = "_invalid";
2
+ export declare const RATE_LIMITED_KEYS = "RATE_LIMITED_KEYS";
3
+ export declare const DATABLOCK_API_KEYS: string[];
4
+ export declare class ApiKeyStorageHelper {
5
+ static getApiKey(keyName: string): string;
6
+ static clearApiKeys(): void;
7
+ static saveApiKey(keyName: string, key: string): void;
8
+ static removeApiKey(keyName: string): void;
9
+ static getAllSupportedApiKeys(): Record<string, string>;
10
+ static getListOfRateLimitedKeys(): any;
11
+ static markKeyAsRateLimited(key: string): void;
12
+ }
13
+ export declare const getApiKey: (keyName: string) => string;
14
+ export declare const clearApiKeys: () => void;
15
+ export declare const saveApiKey: (keyName: string, key: string) => void;
16
+ export declare const removeApiKey: (keyName: string) => void;
17
+ export declare const getListOfRateLimitedKeys: () => any;
18
+ export declare const getAllSupportedApiKeysInLs: () => Record<string, string>;
19
+ export declare const markKeyAsRateLimited: (key: string) => void;
@@ -0,0 +1,30 @@
1
+ type SheetEditorRefLike = {
2
+ current: {
3
+ getWorkbookSetContext?: () => unknown;
4
+ } | null;
5
+ } | null | undefined;
6
+ /**
7
+ * Clears the comment indicator from a cell.
8
+ *
9
+ * - Hides the package-rendered marker DOM node immediately so the user sees
10
+ * the change without waiting for a re-render.
11
+ * - Sets `cell.ps = undefined` in the workbook model so the dsheet package
12
+ * stops drawing the marker on subsequent renders / persists.
13
+ *
14
+ * Used on top-level comment delete and on top-level comment resolve.
15
+ */
16
+ export declare const hideCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number) => void;
17
+ export declare const closeCellCommentPopup: (sheetEditorRef: SheetEditorRefLike) => void;
18
+ /**
19
+ * Restores the comment indicator on a cell.
20
+ *
21
+ * - Removes the inline `display: none` we set on hide so the package's marker
22
+ * DOM node becomes visible again if it still exists.
23
+ * - Re-creates a minimal `cell.ps` stub in the workbook model so the package
24
+ * redraws the marker on next render. Geometry fields are `null` so the
25
+ * package recomputes them; the existing `ps` is preserved if already set.
26
+ *
27
+ * Used on top-level comment unresolve.
28
+ */
29
+ export declare const showCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number, value?: string) => void;
30
+ export {};
@@ -0,0 +1,7 @@
1
+ import { CellPosition } from '../types/comments';
2
+
3
+ export declare const parseCellKey: (key: string) => CellPosition | null;
4
+ export declare const generateWithoutCellKey: (dataLength: number) => string;
5
+ export declare const isCellComment: (key: string) => boolean;
6
+ export declare const getCellReference: (row: number, col: number) => string;
7
+ export declare const formatCommentDateTime: (dateString: string) => string;
@@ -0,0 +1,28 @@
1
+ import { CellMatrix, CellWithRowAndCol, Sheet } from '../../sheet-engine/core/types';
2
+ import { SheetChangePath } from './update-ydoc';
3
+ import * as Y from 'yjs';
4
+ export declare const CELLDATA_COMPACT_STORAGE_KEY_PREFIX = "dsheet-celldata-compact-v1:";
5
+ export type CelldataCompactionResult = {
6
+ removedFromYdoc: number;
7
+ clearedInMemory: number;
8
+ changes: SheetChangePath[];
9
+ };
10
+ export declare function celldataCompactStorageKey(dsheetId: string): string;
11
+ export declare function hasCelldataCompactionCompleted(dsheetId: string): boolean;
12
+ export declare function markCelldataCompactionCompleted(dsheetId: string): void;
13
+ /** Collect Yjs celldata keys that should not be persisted (format-only / empty ghosts). */
14
+ export declare function collectStaleCelldataKeys(celldataMap: Y.Map<unknown> | Record<string, unknown> | null | undefined): string[];
15
+ export declare function buildCelldataDeleteChanges(sheetId: string, keys: string[]): SheetChangePath[];
16
+ /** Null out dense-grid cells that should not be persisted. */
17
+ export declare function compactSheetDataMatrix(data: CellMatrix | null | undefined): number;
18
+ /** Drop sparse celldata entries that should not be persisted. */
19
+ export declare function compactSheetCelldataArray(celldata: CellWithRowAndCol[] | null | undefined): {
20
+ next: CellWithRowAndCol[];
21
+ removed: number;
22
+ };
23
+ export declare function compactInMemorySheets(sheets: Sheet[] | null | undefined): number;
24
+ /**
25
+ * Scan Y.Doc for committed celldata ghosts. Does not mutate — caller applies
26
+ * `changes` via `updateYdocSheetData`.
27
+ */
28
+ export declare function planYdocCelldataCompaction(ydoc: Y.Doc, dsheetId: string): CelldataCompactionResult;
@@ -0,0 +1,20 @@
1
+ import { WorkbookInstance } from '../../sheet-engine/react';
2
+ import { SheetChangePath } from './update-ydoc';
3
+
4
+ import * as Y from 'yjs';
5
+ /** Diff top-level config sub-keys and emit granular Yjs updates. */
6
+ export declare function buildConfigSubKeyChanges({ sheetId, oldConfig, newConfig, }: {
7
+ sheetId: string;
8
+ oldConfig: Record<string, any>;
9
+ newConfig: Record<string, any>;
10
+ }): SheetChangePath[];
11
+ /**
12
+ * Sync active sheet config sub-keys to Yjs (borderInfo, merge, rowlen, …).
13
+ * Replaces whole-config writes so only changed sub-keys are broadcast.
14
+ */
15
+ export declare const configYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal, }: {
16
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
17
+ ydocRef: React.RefObject<Y.Doc | null>;
18
+ dsheetId: string;
19
+ handleContentPortal?: any;
20
+ }) => void;
@@ -2,4 +2,6 @@ import { default as React } from 'react';
2
2
  import { WorkbookInstance } from '../../sheet-engine/react';
3
3
 
4
4
  import * as Y from 'yjs';
5
- export declare const handleCSVUpload: (event: React.ChangeEventHandler<HTMLInputElement> | undefined, ydoc: Y.Doc | null, setForceSheetRender: React.Dispatch<React.SetStateAction<number>>, dsheetId: string, currentDataRef: React.MutableRefObject<object | null>, sheetEditorRef: React.RefObject<WorkbookInstance | null>, updateDocumentTitle?: (title: string) => void, fileArg?: File, importType?: string, handleContentPortal?: any, separatorType?: string) => Promise<void>;
5
+ export declare const handleCSVUpload: (event: React.ChangeEventHandler<HTMLInputElement> | undefined, ydoc: Y.Doc | null, setForceSheetRender: React.Dispatch<React.SetStateAction<number>>, dsheetId: string, currentDataRef: React.MutableRefObject<object | null>, sheetEditorRef: React.RefObject<WorkbookInstance | null>, updateDocumentTitle?: (title: string) => void, fileArg?: File, importType?: string, handleContentPortal?: any, separatorType?: string, options?: {
6
+ suppressUiWarnings?: boolean;
7
+ }) => Promise<void>;
@@ -0,0 +1,21 @@
1
+ import { Cell, WorkbookInstance } from '../../sheet-engine/react';
2
+ import { DataBlockEvent, ErrorMessageHandlerReturnType } from '../types';
3
+ import { ApiKeyStorage } from './api-key-storage';
4
+ import { SmartContractQueryHandler } from './after-update-cell';
5
+
6
+ export type OpenApiKeyModalFn = (apiKeyName: string, callbacks: {
7
+ onSave: (key: string) => void;
8
+ onClose: () => void;
9
+ }) => void;
10
+ export interface DataBlockErrorHandlerParams {
11
+ data: ErrorMessageHandlerReturnType;
12
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
13
+ row: number;
14
+ column: number;
15
+ newValue: Cell;
16
+ apiKeyStorage: ApiKeyStorage;
17
+ openApiKeyModal: OpenApiKeyModalFn;
18
+ onDataBlockEvent?: (event: DataBlockEvent) => void;
19
+ handleSmartContractQuery?: SmartContractQueryHandler;
20
+ }
21
+ export declare const handleDataBlockError: ({ data, sheetEditorRef, row, column, newValue, apiKeyStorage, openApiKeyModal, onDataBlockEvent, handleSmartContractQuery, }: DataBlockErrorHandlerParams) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const isDatablockError: (value: unknown) => boolean;
@@ -0,0 +1,31 @@
1
+ import { WorkbookInstance } from '../../sheet-engine/react';
2
+ import { DefinedName } from '../../sheet-engine/core/types';
3
+ import { RefObject } from 'react';
4
+
5
+ import * as Y from 'yjs';
6
+ /** Sibling share key on the same Y.Doc as the sheet array. */
7
+ export declare function getDefinedNamesMapKey(dsheetId: string): string;
8
+ export declare function getDefinedNamesYMap(ydoc: Y.Doc, dsheetId: string): Y.Map<DefinedName>;
9
+ /** Read workbook-level named ranges from Yjs (stable name order). */
10
+ export declare function readDefinedNamesFromYdoc(ydoc: Y.Doc, dsheetId: string): DefinedName[];
11
+ /**
12
+ * Prefer the sheet `Y.Array` share key when a doc has sibling maps
13
+ * (e.g. `${dsheetId}:definedNames`).
14
+ */
15
+ export declare function resolveSheetArrayShareKey(doc: Y.Doc, preferredKey?: string): string | null;
16
+ /**
17
+ * Diff Context definedNames against the Y.Map and apply set/delete by id.
18
+ */
19
+ export declare function syncDefinedNamesToYdoc({ ydoc, dsheetId, definedNames, handleContentPortal, }: {
20
+ ydoc: Y.Doc;
21
+ dsheetId: string;
22
+ definedNames: DefinedName[];
23
+ handleContentPortal?: () => void;
24
+ }): void;
25
+ /** Push current workbook definedNames into Yjs (editor hook target). */
26
+ export declare const definedNamesYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal, }: {
27
+ sheetEditorRef: RefObject<WorkbookInstance | null>;
28
+ ydocRef: RefObject<Y.Doc | null>;
29
+ dsheetId: string;
30
+ handleContentPortal?: () => void;
31
+ }) => void;
@@ -0,0 +1,26 @@
1
+ import { RefObject } from 'react';
2
+ import { SheetEditorRef } from '../types/comments';
3
+
4
+ type SheetEditorRefLike = RefObject<SheetEditorRef | null> | null | undefined;
5
+ type WorkbookSheetLike = {
6
+ id?: string;
7
+ order?: number;
8
+ name?: string;
9
+ };
10
+ export declare function isWorkbookReady(ref: SheetEditorRefLike): boolean;
11
+ export declare function getCurrentSheetSafe(ref: SheetEditorRefLike): WorkbookSheetLike | null;
12
+ export declare function getCurrentSheetOrderSafe(ref: SheetEditorRefLike): number;
13
+ export declare function getCurrentSheetIdSafe(ref: SheetEditorRefLike): string;
14
+ export declare function getAllSheetsSafe(ref: SheetEditorRefLike): WorkbookSheetLike[];
15
+ export declare function buildSheetOrderNameMap(ref: SheetEditorRefLike): Map<number, string>;
16
+ /**
17
+ * Returns a map keyed by BOTH the sheet's immutable id AND its numeric
18
+ * order-as-string so that both new (UUID) and legacy (order) comment keys
19
+ * resolve to the correct display name in a single lookup.
20
+ */
21
+ export declare function buildSheetIdNameMap(ref: SheetEditorRefLike): Map<string, string>;
22
+ export declare function findSheetById(ref: SheetEditorRefLike, id: string): WorkbookSheetLike | null;
23
+ export declare function activateSheetById(ref: SheetEditorRefLike, id: string): boolean;
24
+ export declare function findSheetByOrder(ref: SheetEditorRefLike, order: number): WorkbookSheetLike | null;
25
+ export declare function activateSheetByOrder(ref: SheetEditorRefLike, order: number): boolean;
26
+ export {};