@fileverse-dev/dsheet 2.1.2 → 2.1.3-package-cleanup-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 (74) hide show
  1. package/dist/editor/components/api-key-modal/api-key-input.d.ts +5 -0
  2. package/dist/editor/components/api-key-modal/api-key-modal.d.ts +7 -0
  3. package/dist/editor/components/api-key-modal/rate-limit-info.d.ts +4 -0
  4. package/dist/editor/components/comments/comment-actions-dropdown.d.ts +19 -0
  5. package/dist/editor/components/comments/comment-cell-popup.d.ts +4 -0
  6. package/dist/editor/components/comments/comment-input.d.ts +4 -0
  7. package/dist/editor/components/comments/comment-item.d.ts +4 -0
  8. package/dist/editor/components/comments/comment-sidebar-empty.d.ts +4 -0
  9. package/dist/editor/components/comments/comment-sidebar.d.ts +4 -0
  10. package/dist/editor/components/comments/ens/ens-cache.d.ts +10 -0
  11. package/dist/editor/components/comments/ens/use-ens-status.d.ts +10 -0
  12. package/dist/editor/components/comments/use-comment-cell-popup.d.ts +12 -0
  13. package/dist/editor/components/comments/use-comment-permissions.d.ts +15 -0
  14. package/dist/editor/components/editor-workbook.d.ts +11 -14
  15. package/dist/editor/components/sidebar/editor-right-sidebar.d.ts +20 -0
  16. package/dist/editor/components/sidebar/right-sidebar.d.ts +14 -0
  17. package/dist/editor/components/sidebar/sidebar-context.d.ts +17 -0
  18. package/dist/editor/components/sidebar/sidebar-portal-registry.d.ts +20 -0
  19. package/dist/editor/components/sidebar/use-right-panels.d.ts +12 -0
  20. package/dist/editor/components/sidebars/conditional-format.d.ts +2 -0
  21. package/dist/editor/components/sidebars/data-verification.d.ts +2 -0
  22. package/dist/editor/components/sidebars/function/function-categories-logic.d.ts +11 -0
  23. package/dist/editor/components/sidebars/function/function-categories.d.ts +6 -0
  24. package/dist/editor/components/sidebars/function/function-metadata.d.ts +7 -0
  25. package/dist/editor/components/sidebars/function/functionList.d.ts +8 -0
  26. package/dist/editor/components/sidebars/function/types.d.ts +24 -0
  27. package/dist/editor/components/sidebars/function/use-functions.d.ts +20 -0
  28. package/dist/editor/components/sidebars/function-content.d.ts +8 -0
  29. package/dist/editor/components/sidebars/template-ui.d.ts +22 -0
  30. package/dist/editor/components/sidebars/templates.d.ts +9 -0
  31. package/dist/editor/contexts/editor-context.d.ts +16 -4
  32. package/dist/editor/dsheet-editor.d.ts +1 -1
  33. package/dist/editor/hooks/live-query/use-live-query.d.ts +4 -2
  34. package/dist/editor/hooks/use-editor-data.d.ts +4 -2
  35. package/dist/editor/types/comments.d.ts +133 -0
  36. package/dist/editor/types.d.ts +36 -29
  37. package/dist/editor/utils/after-update-cell.d.ts +13 -8
  38. package/dist/editor/utils/api-key-storage.d.ts +6 -0
  39. package/dist/editor/utils/api-keys-local-storage.d.ts +19 -0
  40. package/dist/editor/utils/cell-comment-marker.d.ts +29 -0
  41. package/dist/editor/utils/comment-key-utils.d.ts +7 -0
  42. package/dist/editor/utils/data-block-error-handler.d.ts +21 -0
  43. package/dist/editor/utils/datablock-error-utils.d.ts +1 -0
  44. package/dist/editor/utils/sheet-editor-safe.d.ts +26 -0
  45. package/dist/{executeStringFunction-CGbxAbbw.js → executeStringFunction-C26SXUpc.js} +4741 -4363
  46. package/dist/formula.js +1 -1
  47. package/dist/index-DSogq3Tz.js +55498 -0
  48. package/dist/index.d.ts +8 -1
  49. package/dist/index.es.js +55 -51
  50. package/dist/sheet-engine/core/context.d.ts +5 -0
  51. package/dist/sheet-engine/core/index.d.ts +1 -1
  52. package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +53 -0
  53. package/dist/sheet-engine/core/modules/formula-eval.worker.d.ts +1 -0
  54. package/dist/sheet-engine/core/modules/formula-range-cache.d.ts +20 -0
  55. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +40 -0
  56. package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +7 -0
  57. package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +16 -0
  58. package/dist/sheet-engine/core/modules/formula-worker-types.d.ts +24 -0
  59. package/dist/sheet-engine/core/modules/formula.d.ts +26 -1
  60. package/dist/sheet-engine/core/modules/index.d.ts +3 -1
  61. package/dist/sheet-engine/core/theme.d.ts +67 -0
  62. package/dist/sheet-engine/react/components/SheetOverlay/Icon.d.ts +5 -4
  63. package/dist/sheet-engine/react/components/SheetOverlay/LucideIcon.d.ts +4 -4
  64. package/dist/sheet-engine/react/components/SidebarPanelPortals/index.d.ts +17 -0
  65. package/dist/sheet-engine/react/components/Workbook/index.d.ts +6 -0
  66. package/dist/sheet-engine/react/components/index.d.ts +1 -0
  67. package/dist/sheet-engine/react/utils/datepickerStyles.d.ts +1 -1
  68. package/dist/style.css +1 -1
  69. package/dist/{use-xlsx-import-impl-arHLnoR4.js → use-xlsx-import-impl-C-PHnu49.js} +2 -2
  70. package/dist/{xlsx-export-impl-t86QBMF3.js → xlsx-export-impl-BAJCFNh6.js} +2 -2
  71. package/package.json +4 -3
  72. package/dist/index-DzIdZpns.js +0 -52604
  73. package/dist/sheet-engine/react/components/Toolbar/conditionalFormatPortal.d.ts +0 -7
  74. package/dist/sheet-engine/react/components/Toolbar/dataVerificationPortal.d.ts +0 -6
@@ -1,10 +1,16 @@
1
- import { Sheet, Workbook, WorkbookInstance, Cell } from '../sheet-engine/react';
2
- import { ComponentProps, RefObject } from 'react';
1
+ import { Sheet, WorkbookInstance } from '../sheet-engine/react';
2
+ import { RefObject } from 'react';
3
3
  import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
4
4
  import { SmartContractQueryHandler } from './utils/after-update-cell';
5
5
  import { CollaborationProps } from '../sync-local/types';
6
+ import { CommentsConfig } from './types/comments';
7
+ import { ApiKeyStorage } from './utils/api-key-storage';
8
+ import { ThemeKey } from '../sheet-engine/core/theme';
6
9
 
7
10
  import * as Y from 'yjs';
11
+ export type { ThemeKey } from '../sheet-engine/core/theme';
12
+ export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
13
+ export { CommentAction } from './types/comments';
8
14
  export interface SheetUpdateData {
9
15
  data: Sheet[];
10
16
  }
@@ -12,7 +18,19 @@ export interface EditorValues {
12
18
  sheetEditorRef: RefObject<WorkbookInstance>;
13
19
  currentDataRef: React.MutableRefObject<Sheet[] | null>;
14
20
  ydocRef: React.RefObject<Y.Doc | null>;
21
+ openPanel: (panelId: string) => void;
22
+ closePanel: () => void;
15
23
  }
24
+ export interface PanelConfig {
25
+ id: string;
26
+ header: {
27
+ title: string;
28
+ subtitle?: string;
29
+ };
30
+ width?: string;
31
+ content: React.ReactNode;
32
+ }
33
+ export type { PanelId, BuiltInPanelType, } from './components/sidebar/use-right-panels';
16
34
  export type OnboardingHandlerType = (params: {
17
35
  row: number;
18
36
  column: number;
@@ -21,27 +39,14 @@ export type OnboardingHandlerType = (params: {
21
39
  row: number;
22
40
  column: number;
23
41
  };
24
- export type DataBlockApiKeyHandlerType = (params: {
25
- data: ErrorMessageHandlerReturnType;
26
- sheetEditorRef: React.RefObject<WorkbookInstance | null>;
27
- executeStringFunction: ({ functionCallString, sheetEditorRef, dataBlockRow, dataBlockColumn, handleSmartContractQuery, }: {
28
- functionCallString: string;
29
- sheetEditorRef: React.RefObject<WorkbookInstance | null>;
30
- dataBlockRow: number;
31
- dataBlockColumn: number;
32
- handleSmartContractQuery: SmartContractQueryHandler;
33
- }) => Promise<unknown>;
34
- row: number;
35
- column: number;
36
- newValue: Cell;
37
- formulaResponseUiSync: (params: {
38
- row: number;
39
- column: number;
40
- newValue: Record<string, string>;
41
- apiData: Array<Record<string, object>>;
42
- sheetEditorRef: React.RefObject<WorkbookInstance | null>;
43
- }) => void;
44
- }) => void;
42
+ export type DataBlockEventType = 'success' | 'error' | 'api-key-required' | 'api-key-saved' | 'retry';
43
+ export interface DataBlockEvent {
44
+ type: DataBlockEventType;
45
+ functionName?: string;
46
+ errorType?: string;
47
+ apiKeyName?: string;
48
+ }
49
+ export type { ApiKeyStorage } from './utils/api-key-storage';
45
50
  export interface DsheetProps {
46
51
  isNewSheet: boolean;
47
52
  setSelectedTemplate?: React.Dispatch<React.SetStateAction<string>>;
@@ -67,17 +72,16 @@ export interface DsheetProps {
67
72
  /** When `onboardingComplete` is omitted, read `localStorage.getItem(key)==='true'` (default key `onboardingComplete`). */
68
73
  onboardingCompleteLocalStorageKey?: string;
69
74
  onboardingHandler?: OnboardingHandlerType;
70
- dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType;
71
75
  setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
72
- getCommentCellUI?: ComponentProps<typeof Workbook>['getCommentCellUI'];
73
- commentData?: Object;
76
+ commentsConfig?: CommentsConfig;
74
77
  toggleTemplateSidebar?: () => void;
75
78
  sheetEditorRef?: RefObject<WorkbookInstance & {
76
79
  refreshIndexedDB: () => Promise<void>;
77
80
  }>;
78
- storeApiKey?: (apiKeyName: string) => void;
79
- allowComments?: boolean;
80
- onDataBlockApiResponse?: (dataBlockName: string) => void;
81
+ /** Override where datablock API keys are stored (default: localStorage). */
82
+ apiKeyStorage?: ApiKeyStorage;
83
+ /** Optional lifecycle events for analytics / side-effects. */
84
+ onDataBlockEvent?: (event: DataBlockEvent) => void;
81
85
  onDuneChartEmbed?: () => void;
82
86
  onSheetCountChange?: (sheetCount: number) => void;
83
87
  editorStateRef?: React.MutableRefObject<{
@@ -86,6 +90,9 @@ export interface DsheetProps {
86
90
  handleSmartContractQuery?: SmartContractQueryHandler;
87
91
  enableLiveQuery?: boolean;
88
92
  liveQueryRefreshRate?: number;
93
+ customPanels?: PanelConfig[];
94
+ /** Active theme; drives the canvas/grid palette (chrome themes via the <html> class). */
95
+ theme?: ThemeKey;
89
96
  }
90
97
  export type BaseError = {
91
98
  message: string;
@@ -1,7 +1,10 @@
1
1
  import { Cell, WorkbookInstance } from '../../sheet-engine/react';
2
- import { OnboardingHandlerType, DataBlockApiKeyHandlerType } from '../types';
2
+ import { OnboardingHandlerType, DataBlockEvent } from '../types';
3
3
  import { LiveQueryData } from '../../sheet-engine/core';
4
+ import { OpenApiKeyModalFn } from './data-block-error-handler';
5
+ import { ApiKeyStorage } from './api-key-storage';
4
6
 
7
+ import * as Y from 'yjs';
5
8
  export type SmartContractResponse = {
6
9
  callSignature: unknown[];
7
10
  };
@@ -22,15 +25,18 @@ interface AfterUpdateCellParams {
22
25
  oldValue?: Cell;
23
26
  newValue: Cell;
24
27
  sheetEditorRef: React.RefObject<WorkbookInstance | null>;
28
+ handleContentPortal?: () => void;
29
+ dsheetId?: string;
30
+ ydocRef?: React.MutableRefObject<Y.Doc | null>;
25
31
  onboardingComplete: boolean | undefined;
26
- setFetchingURLData: (fetching: boolean) => void;
32
+ setFetchingURLData?: (fetching: boolean) => void;
27
33
  onboardingHandler: OnboardingHandlerType | undefined;
28
- dataBlockApiKeyHandler: DataBlockApiKeyHandlerType | undefined;
34
+ apiKeyStorage: ApiKeyStorage;
35
+ openApiKeyModal: OpenApiKeyModalFn;
36
+ onDataBlockEvent?: (event: DataBlockEvent) => void;
29
37
  handleSmartContractQuery?: SmartContractQueryHandler | undefined;
30
38
  handleLiveQueryData?: (subsheetIndex: number, queryData: LiveQueryData) => void;
31
- setInputFetchURLDataBlock: React.Dispatch<React.SetStateAction<string>> | undefined;
32
- storeApiKey?: (apiKeyName: string) => void;
33
- onDataBlockApiResponse?: (dataBlockName: string) => void;
39
+ setInputFetchURLDataBlock?: React.Dispatch<React.SetStateAction<string>> | undefined;
34
40
  setDataBlockCalcFunction?: React.Dispatch<React.SetStateAction<{
35
41
  [key: string]: {
36
42
  [key: string]: any;
@@ -54,7 +60,7 @@ export declare const shouldExecuteDataBlocks: (params: {
54
60
  localUserEditRef?: React.MutableRefObject<boolean>;
55
61
  sheetEditorRef: React.RefObject<WorkbookInstance | null>;
56
62
  }) => boolean;
57
- export declare const isDatablockError: (value: any) => boolean;
63
+ export { isDatablockError } from './datablock-error-utils';
58
64
  /**
59
65
  * Handles logic after a cell is updated, including processing formula results
60
66
  *
@@ -62,4 +68,3 @@ export declare const isDatablockError: (value: any) => boolean;
62
68
  * @returns Promise that resolves when processing is complete
63
69
  */
64
70
  export declare const afterUpdateCell: (params: AfterUpdateCellParams) => Promise<void>;
65
- export {};
@@ -0,0 +1,6 @@
1
+ export interface ApiKeyStorage {
2
+ get: (name: string) => string | null;
3
+ set: (name: string, key: string) => void;
4
+ remove?: (name: string) => void;
5
+ }
6
+ export declare const defaultApiKeyStorage: ApiKeyStorage;
@@ -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,29 @@
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
+ /**
18
+ * Restores the comment indicator on a cell.
19
+ *
20
+ * - Removes the inline `display: none` we set on hide so the package's marker
21
+ * DOM node becomes visible again if it still exists.
22
+ * - Re-creates a minimal `cell.ps` stub in the workbook model so the package
23
+ * redraws the marker on next render. Geometry fields are `null` so the
24
+ * package recomputes them; the existing `ps` is preserved if already set.
25
+ *
26
+ * Used on top-level comment unresolve.
27
+ */
28
+ export declare const showCellCommentMarker: (sheetEditorRef: SheetEditorRefLike, row: number, col: number, value?: string) => void;
29
+ 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,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,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 {};