@fileverse-dev/dsheet 4.0.3 → 4.0.5

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 (41) hide show
  1. package/dist/{constants-Cdz6oSCq.js → constants-CRFfbkoQ.js} +1 -1
  2. package/dist/constants.js +1 -1
  3. package/dist/{crypto-constants-CqpCRs86.js → crypto-constants-ZTlAYRUf.js} +33 -22
  4. package/dist/editor/components/sidebar/use-right-panels.d.ts +1 -1
  5. package/dist/editor/components/sidebars/named-ranges.d.ts +2 -0
  6. package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -3
  7. package/dist/editor/utils/compact-committed-celldata.d.ts +11 -10
  8. package/dist/editor/utils/defined-names-ydoc.d.ts +31 -0
  9. package/dist/editor/utils/import-compaction.d.ts +25 -0
  10. package/dist/editor/utils/xlsx-defined-names.d.ts +41 -0
  11. package/dist/editor/utils/xlsx-import-pipeline.d.ts +28 -0
  12. package/dist/{executeStringFunction-BQvE7aeV.js → executeStringFunction-B6fhDKyN.js} +7014 -6490
  13. package/dist/formula.js +1 -1
  14. package/dist/{index-CeTa91qc.js → index-BqGOKo9u.js} +15445 -14688
  15. package/dist/index.es.js +22 -22
  16. package/dist/sheet-engine/core/api/common.d.ts +1 -0
  17. package/dist/sheet-engine/core/context.d.ts +3 -1
  18. package/dist/sheet-engine/core/index.d.ts +2 -2
  19. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +11 -0
  20. package/dist/sheet-engine/core/modules/formula.d.ts +27 -0
  21. package/dist/sheet-engine/core/modules/index.d.ts +3 -2
  22. package/dist/sheet-engine/core/modules/namedRanges.d.ts +53 -0
  23. package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +2 -0
  24. package/dist/sheet-engine/core/settings.d.ts +2 -0
  25. package/dist/sheet-engine/core/types.d.ts +21 -0
  26. package/dist/sheet-engine/react/components/NamedRanges/index.d.ts +4 -0
  27. package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -0
  28. package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
  29. package/dist/style.css +1 -1
  30. package/dist/{template-data-list-oP1s0Uxn.js → template-data-list-RKnVLsuf.js} +51 -50
  31. package/dist/use-xlsx-import-impl-Bddlxx23.js +1898 -0
  32. package/dist/worker/dsheet-worker-client.d.ts +14 -0
  33. package/dist/worker/dsheet-worker.d.ts +14 -0
  34. package/dist/xlsx-defined-names-DsWdNZw-.js +117 -0
  35. package/dist/xlsx-export-impl-DJiXCevi.js +831 -0
  36. package/dist/xlsx-hyperlink-inline-CTg4_gg1.js +2512 -0
  37. package/package.json +5 -4
  38. package/dist/use-xlsx-import-impl-BVsfV8ZV.js +0 -1572
  39. package/dist/xlsx-export-impl-Ber9FhFY.js +0 -3138
  40. package/dist/xlsx-hyperlink-inline-DzewAypN.js +0 -71
  41. package/dist/xlsx-image-utils-Cvg0qxRA.js +0 -126
@@ -1,4 +1,4 @@
1
- import { E as a, S as n } from "./crypto-constants-CqpCRs86.js";
1
+ import { E as a, S as n } from "./crypto-constants-ZTlAYRUf.js";
2
2
  const E = a, d = n, f = [
3
3
  {
4
4
  id: "0",
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as R, c as _, E as C, S as a, p as s } from "./constants-Cdz6oSCq.js";
1
+ import { a as R, c as _, E as C, S as a, p as s } from "./constants-CRFfbkoQ.js";
2
2
  export {
3
3
  R as COLLAB_PRESENCE_COLORS,
4
4
  _ as ENS_PRESENCE_COLOR,
@@ -12,7 +12,7 @@ var g = Object.create, u = Object.defineProperty, y = Object.getOwnPropertyDescr
12
12
  // "default" to the CommonJS "module.exports" for node compatibility.
13
13
  u(i, "default", { value: n, enumerable: !0 }),
14
14
  n
15
- )), v = m({
15
+ )), C = m({
16
16
  "node_modules/jwt-decode/lib/atob.js"(n, e) {
17
17
  var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
18
18
  function r(a) {
@@ -37,9 +37,9 @@ var g = Object.create, u = Object.defineProperty, y = Object.getOwnPropertyDescr
37
37
  }
38
38
  e.exports = typeof window < "u" && window.atob && window.atob.bind(window) || t;
39
39
  }
40
- }), C = m({
40
+ }), v = m({
41
41
  "node_modules/jwt-decode/lib/base64_url_decode.js"(n, e) {
42
- var i = v();
42
+ var i = C();
43
43
  function r(t) {
44
44
  return decodeURIComponent(i(t).replace(/(.)/g, function(a, o) {
45
45
  var s = o.charCodeAt(0).toString(16).toUpperCase();
@@ -69,7 +69,7 @@ var g = Object.create, u = Object.defineProperty, y = Object.getOwnPropertyDescr
69
69
  }
70
70
  }), O = m({
71
71
  "node_modules/jwt-decode/lib/index.js"(n, e) {
72
- var i = C();
72
+ var i = v();
73
73
  function r(t) {
74
74
  this.message = t;
75
75
  }
@@ -85,7 +85,7 @@ var g = Object.create, u = Object.defineProperty, y = Object.getOwnPropertyDescr
85
85
  }
86
86
  }, e.exports.InvalidTokenError = r;
87
87
  }
88
- }), k = m({
88
+ }), S = m({
89
89
  "node_modules/jwt-check-expiration/src/index.js"(n, e) {
90
90
  var i = O(), r = (t) => {
91
91
  if (typeof t != "string" || !t) throw new Error("Invalid token provided");
@@ -114,7 +114,7 @@ var g = Object.create, u = Object.defineProperty, y = Object.getOwnPropertyDescr
114
114
  Neynar: "Neynar",
115
115
  Defillama: "Defillama",
116
116
  DuneSim: "DuneSim"
117
- }, S = {
117
+ }, k = {
118
118
  API_KEY: l.Etherscan,
119
119
  LOGO: "https://raw.githubusercontent.com/ethereum/ethereum-org/master/dist/favicon.ico",
120
120
  BRAND_COLOR: "#F6F7F8",
@@ -256,22 +256,23 @@ Pagination is supported for all except single-exchange derivatives.`,
256
256
  {
257
257
  name: "category",
258
258
  detail: 'Query type: "price", "market", "stablecoins", or "derivatives".',
259
- example: '"stablecoins"',
259
+ example: '"price"',
260
260
  require: "m"
261
261
  },
262
262
  {
263
263
  name: "param1",
264
- detail: `If "price" then - eg. "BTC", "ETH", OR any token on coingecko
264
+ detail: `If "price" then - CoinGecko coin ids, eg. "bitcoin", "ethereum", "bitcoin,ethereum" (not ticker symbols like "btc").
265
265
  If "market": one of "all", "base", "meme", "aiagents", "bitcoin", "ethereum", "hyperliquid", "pump", "solana".
266
266
  If "stablecoins": one of "all", "yield-bearing-stablecoins", "crypto-backed-stablecoin".
267
267
  If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-futures", "bybit" ).`,
268
- example: '"yield-bearing-stablecoins"',
268
+ example: '"bitcoin"',
269
269
  require: "m"
270
270
  },
271
271
  {
272
272
  name: "param2",
273
- detail: 'If "market" and "stablecoins" then eg. "1h", "24h", "7d", "14d", "30d", "200d", "1y".',
274
- example: '"1h,24h,7d"',
273
+ detail: `If "price" then vs currency (default "usd"), eg. "usd", "eur".
274
+ If "market" and "stablecoins" then eg. "1h", "24h", "7d", "14d", "30d", "200d", "1y".`,
275
+ example: '"usd"',
275
276
  require: "o"
276
277
  },
277
278
  {
@@ -283,6 +284,16 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
283
284
  }
284
285
  ],
285
286
  examples: [
287
+ {
288
+ title: "COINGECKO",
289
+ argumentString: '"price", "bitcoin"',
290
+ description: "returns the current Bitcoin price in USD (e.g. BITCOIN_USD)."
291
+ },
292
+ {
293
+ title: "COINGECKO",
294
+ argumentString: '"price", "bitcoin,ethereum", "usd"',
295
+ description: "returns current Bitcoin and Ethereum prices in USD."
296
+ },
286
297
  {
287
298
  title: "COINGECKO",
288
299
  argumentString: '"stablecoins", "yield-bearing-stablecoins", "1h,24h,7d"',
@@ -559,7 +570,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
559
570
  argumentString: '"{100, 200, 150}", "{250, 300, 200}"',
560
571
  description: "returns the total profit or loss by subtracting the costs {100, 200, 150} from the revenues {250, 300, 200}."
561
572
  }]
562
- }, w = {
573
+ }, I = {
563
574
  API_KEY: l.Safe,
564
575
  LOGO: "https://safe.global/favicon.ico",
565
576
  BRAND_COLOR: "#ebf9f3",
@@ -614,7 +625,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
614
625
  description: "returns the last 100 transactions for the specified Safe address on the Ethereum chain."
615
626
  }
616
627
  ]
617
- }, I = {
628
+ }, w = {
618
629
  LOGO: "https://cdn.prod.website-files.com/65f94dfd53db8b337c808067/68485baa72714ae58f350ce2_bs-logo.png",
619
630
  BRAND_COLOR: "#f8f8fd",
620
631
  BRAND_SECONDARY_COLOR: "#5353D3",
@@ -858,7 +869,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
858
869
  argumentString: '"proposals", "aave"',
859
870
  description: "returns proposals for the Aave organization from Tally."
860
871
  }]
861
- }, Y = {
872
+ }, U = {
862
873
  API_KEY: l.DuneSim,
863
874
  LOGO: "https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://docs.sim.dune.com&size=32",
864
875
  BRAND_COLOR: "#fef7f5",
@@ -916,7 +927,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
916
927
  description: "returns the latest 10 wallet activities for the address vitalik.eth on the Ethereum chain."
917
928
  }
918
929
  ]
919
- }, U = {
930
+ }, Y = {
920
931
  n: "PRICE",
921
932
  t: 20,
922
933
  d: "Query prices of crypto assets",
@@ -956,7 +967,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
956
967
  description: "returns the prices of ETH and BTC with 1-hour, 24-hour, and 168-hour (7-day) historical offsets."
957
968
  }
958
969
  ]
959
- }, W = {
970
+ }, K = {
960
971
  n: "WALLET",
961
972
  t: 20,
962
973
  d: "Query wallet balance and transactions",
@@ -1003,7 +1014,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
1003
1014
  description: "returns the latest balance for the address vitalik.eth on the Base chain."
1004
1015
  }
1005
1016
  ]
1006
- }, K = {
1017
+ }, W = {
1007
1018
  n: "YIELD",
1008
1019
  t: 20,
1009
1020
  d: "Query yields",
@@ -1077,7 +1088,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
1077
1088
  description: "returns the last 5 transactions for the specified Circles address."
1078
1089
  }]
1079
1090
  }, V = [
1080
- S,
1091
+ k,
1081
1092
  D,
1082
1093
  R,
1083
1094
  _,
@@ -1085,16 +1096,16 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
1085
1096
  N,
1086
1097
  T,
1087
1098
  L,
1088
- w,
1089
1099
  I,
1100
+ w,
1090
1101
  B,
1091
1102
  F,
1092
1103
  P,
1093
1104
  G,
1094
- Y,
1095
1105
  U,
1096
- W,
1106
+ Y,
1097
1107
  K,
1108
+ W,
1098
1109
  Q
1099
1110
  // GNOSISPAY_metadata,
1100
1111
  /*{
@@ -1146,7 +1157,7 @@ If "derivatives": exchange name (e.g., "binance_futures", "hyperliquid", "weex-f
1146
1157
  p: []
1147
1158
  }*/
1148
1159
  ];
1149
- E(k());
1160
+ E(S());
1150
1161
  export {
1151
1162
  M as E,
1152
1163
  V as F,
@@ -1,4 +1,4 @@
1
- export type BuiltInPanelType = 'templates' | 'comments' | 'functions' | 'data-verification' | 'conditional-format';
1
+ export type BuiltInPanelType = 'templates' | 'comments' | 'functions' | 'data-verification' | 'conditional-format' | 'named-ranges';
2
2
  export type PanelId = BuiltInPanelType | string;
3
3
  interface UseRightPanelsReturn {
4
4
  activePanel: PanelId | null;
@@ -0,0 +1,2 @@
1
+ declare const NamedRanges: () => import("react/jsx-runtime").JSX.Element;
2
+ export { NamedRanges };
@@ -15,9 +15,8 @@ type UseCelldataCompactionArgs = {
15
15
  collabSyncing: boolean;
16
16
  };
17
17
  /**
18
- * One-shot background compaction: remove committed celldata entries that copy/paste
19
- * would never write (`shouldPersistCelldataCell` === false). Runs once per dsheetId
20
- * after the editor is synced and idle so it does not compete with load or edits.
18
+ * One-shot background compaction (celldata + borderInfo). Completion is stored
19
+ * on the anchor sheet's config in Yjs so it syncs across devices.
21
20
  */
22
21
  export declare function useCelldataCompaction({ dsheetId, ydocRef, sheetEditorRef, currentDataRef, handleOnChangePortalUpdate, syncStatus, isDataLoaded, isReadOnly, remoteUpdateRef, collabSyncing, }: UseCelldataCompactionArgs): void;
23
22
  export {};
@@ -1,15 +1,19 @@
1
1
  import { CellMatrix, CellWithRowAndCol, Sheet } from '../../sheet-engine/core/types';
2
2
  import { SheetChangePath } from './update-ydoc';
3
3
  import * as Y from 'yjs';
4
- export declare const CELLDATA_COMPACT_STORAGE_KEY_PREFIX = "dsheet-celldata-compact-v1:";
5
- export type CelldataCompactionResult = {
4
+ /** Celldata + borderInfo compaction; bump when rules change. */
5
+ export declare const SHEET_COMPACTION_REV = 2;
6
+ export declare const SHEET_COMPACTION_CONFIG_KEY = "sheetCompactionRev";
7
+ export type SheetCompactionResult = {
6
8
  removedFromYdoc: number;
7
9
  clearedInMemory: number;
8
10
  changes: SheetChangePath[];
9
11
  };
10
- export declare function celldataCompactStorageKey(dsheetId: string): string;
11
- export declare function hasCelldataCompactionCompleted(dsheetId: string): boolean;
12
- export declare function markCelldataCompactionCompleted(dsheetId: string): void;
12
+ export declare function readSheetCompactionRev(config: unknown): number;
13
+ export declare function getAnchorSheet(sheets: Sheet[] | null | undefined): Sheet | null;
14
+ export declare function hasSheetCompactionCompleted(ydoc: Y.Doc, dsheetId: string): boolean;
15
+ export declare function buildCompactionRevChange(ydoc: Y.Doc, dsheetId: string): SheetChangePath | null;
16
+ export declare function markCompactionRevInMemory(sheets: Sheet[] | null | undefined): void;
13
17
  /** Collect Yjs celldata keys that should not be persisted (format-only / empty ghosts). */
14
18
  export declare function collectStaleCelldataKeys(celldataMap: Y.Map<unknown> | Record<string, unknown> | null | undefined): string[];
15
19
  export declare function buildCelldataDeleteChanges(sheetId: string, keys: string[]): SheetChangePath[];
@@ -21,8 +25,5 @@ export declare function compactSheetCelldataArray(celldata: CellWithRowAndCol[]
21
25
  removed: number;
22
26
  };
23
27
  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;
28
+ /** Scan Y.Doc for committed ghosts. Does not mutate — caller applies `changes`. */
29
+ export declare function planYdocCompaction(ydoc: Y.Doc, dsheetId: string): SheetCompactionResult;
@@ -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,25 @@
1
+ import { Sheet } from '../../sheet-engine/react';
2
+
3
+ /**
4
+ * XLSX imports (Google Sheets exports especially) materialize every
5
+ * styled-but-empty cell. Move those into config.cellFormatRanges — the same
6
+ * sparse representation the editor uses — so they never inflate celldata/Yjs.
7
+ * Cells with content, merges, hyperlinks, notes or masks are kept verbatim.
8
+ */
9
+ export declare function compactImportedSheetFormatting(sheet: Sheet): void;
10
+ /**
11
+ * Imported validations repeat the full option list + per-option color string
12
+ * on every covered cell (whole-column dropdowns → thousands of copies). Store
13
+ * each unique entry once in dataVerificationDefs and keep numeric refs in the
14
+ * per-cell map; expandSheetDataVerification restores objects for the engine.
15
+ */
16
+ export declare function internImportedDataVerification(sheet: Sheet): void;
17
+ /**
18
+ * Resolve interned dataVerification refs back to shared entry objects before
19
+ * the sheet reaches the engine or the XLSX exporter. No-op (and no mutation)
20
+ * when the map already holds objects, so live workbook sheets pass through.
21
+ */
22
+ export declare function expandSheetDataVerification<T extends {
23
+ dataVerification?: unknown;
24
+ dataVerificationDefs?: unknown;
25
+ }>(sheet: T): T;
@@ -0,0 +1,41 @@
1
+ import { DefinedName } from '../../sheet-engine/core/types';
2
+
3
+ export type ExcelDefinedNameEntry = {
4
+ name: string;
5
+ ranges: string[];
6
+ localSheetId?: number;
7
+ };
8
+ export declare function isExcelSystemDefinedName(name: string): boolean;
9
+ /** Build Excel loc string: `Sheet1!$A$1:$C$2` (or single cell). */
10
+ export declare function encodeDefinedNameExcelRef(sheetName: string, range: DefinedName['range']): string;
11
+ /**
12
+ * Parse `Sheet1!$A$1:$B$2` / `'My Sheet'!$A$1` into sheet name + 0-based range.
13
+ */
14
+ export declare function parseExcelDefinedNameRef(ref: string): {
15
+ sheetName: string;
16
+ range: {
17
+ row: [number, number];
18
+ column: [number, number];
19
+ };
20
+ } | null;
21
+ /**
22
+ * Convert Excel defined-name entries into our DefinedName list.
23
+ * `sheets` must already have stable ids and names (Excel order).
24
+ */
25
+ export declare function excelEntriesToDefinedNames(entries: ExcelDefinedNameEntry[], sheets: Array<{
26
+ id?: string;
27
+ name?: string;
28
+ }>): DefinedName[];
29
+ /** Write defined names onto an ExcelJS workbook (Pass 2). */
30
+ export declare function applyDefinedNamesToExcelWorkbook(excelWorkbook: {
31
+ definedNames: {
32
+ add: (loc: string, name: string) => void;
33
+ };
34
+ }, definedNames: DefinedName[] | undefined, sheets: Array<{
35
+ id?: string;
36
+ name?: string;
37
+ }>): void;
38
+ /**
39
+ * Parse `<definedNames>` from xl/workbook.xml (keeps localSheetId).
40
+ */
41
+ export declare function parseDefinedNamesFromXlsxBuffer(arrayBuffer: ArrayBuffer): Promise<ExcelDefinedNameEntry[]>;
@@ -0,0 +1,28 @@
1
+ import { Sheet } from '../../sheet-engine/react';
2
+ import { ExcelDefinedNameEntry } from './xlsx-defined-names';
3
+
4
+ export declare function generateImportSheetId(): string;
5
+ export type XlsxImportWarning = {
6
+ code: 'tables-unsupported';
7
+ } | {
8
+ code: 'filters-unsupported';
9
+ };
10
+ export type XlsxParseSettings = {
11
+ /** Workbook default column width in px (from the live workbook settings, if any). */
12
+ workbookDefaultColWidth?: number;
13
+ /** Workbook default row height in px (from the live workbook settings, if any). */
14
+ workbookDefaultRowHeight?: number;
15
+ };
16
+ export type XlsxParsedWorkbook = {
17
+ /** Decorated + compacted sheets, ready for the ydoc write. */
18
+ sheets: Sheet[];
19
+ /** Workbook name from luckyexcel info (extension not yet stripped). */
20
+ workbookName: string;
21
+ /** UI warnings to replay on the main thread (toasts/onWarning). */
22
+ warnings: XlsxImportWarning[];
23
+ /** Sheet ids this pipeline generated — the caller may remap them with a custom generator. */
24
+ generatedSheetIds: string[];
25
+ /** Named ranges from xl/workbook.xml — synced to Yjs on the main thread. */
26
+ definedNameEntries: ExcelDefinedNameEntry[];
27
+ };
28
+ export declare function parseXlsxWorkbook(file: File, settings?: XlsxParseSettings): Promise<XlsxParsedWorkbook>;