@fileverse-dev/dsheet 2.1.2-dropIn-mri-1 → 2.1.2-dropIn-mri-3

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.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C as s, a as t, b as o, S as r, d as l, i as n, T as d, e as i, f as S, g as c, h, j as m, k as C, l as u, n as p, o as E, p as F, q as g, r as x, s as R, t as f, u as A, v as I, w as L, x as w, z as T, A as b, B as v, D as k, E as D, F as M, G as V, H as X, I as z, J as P, K as U } from "./index-CNU6AKC2.js";
2
- import { bV as y, bW as B, bX as G, ar as H, bh as O, e as j, f as q, h as J, a as K, ck as N, aq as W, cs as Y } from "./executeStringFunction-CXFEJvan.js";
1
+ import { C as s, a as t, b as o, S as r, d as l, i as n, T as d, e as i, f as S, g as c, h, j as m, k as C, l as u, n as p, o as E, p as F, q as g, r as x, s as R, t as f, u as A, v as I, w as L, x as w, z as T, A as b, B as v, D as k, E as D, F as M, G as V, H as X, I as z, J as P, K as U } from "./index-BTV_3Y8u.js";
2
+ import { bV as y, bW as B, bX as G, ar as H, bh as O, e as j, f as q, h as J, a as K, ck as N, aq as W, cs as Y } from "./executeStringFunction-BO3vh_NY.js";
3
3
  import { FLVURL as Q } from "@fileverse-dev/formulajs";
4
4
  import { E as ee, S as ae } from "./constants-yStXQJiK.js";
5
5
  export {
@@ -6,6 +6,20 @@ export declare const FORMULA_ASYNC_CHUNK_SIZE = 20;
6
6
  export declare const FORMULA_WORKER_THRESHOLD = 100;
7
7
  /** Formulas evaluated per worker message (larger — runs off main thread). */
8
8
  export declare const FORMULA_WORKER_CHUNK_SIZE = 150;
9
+ /** Maximum time to wait for a worker chunk before falling back to the real engine. */
10
+ export declare const FORMULA_WORKER_CHUNK_TIMEOUT_MS = 30000;
11
+ export type FormulaEvalDebugMode = 'worker' | 'main-thread' | 'fallback';
12
+ export type FormulaEvalDebug = {
13
+ mode: FormulaEvalDebugMode;
14
+ lastChunkMs: number;
15
+ lastChunkSize: number;
16
+ completedChunks: number;
17
+ fallbackChunks: number;
18
+ workerAvailable: boolean;
19
+ unsafeFormulaCount: number;
20
+ workerFormulaCount: number;
21
+ lastError: string | null;
22
+ };
9
23
  export type FormulaAsyncEvalJob = {
10
24
  formulaRunList: Array<{
11
25
  r: number;
@@ -19,8 +33,15 @@ export type FormulaAsyncEvalJob = {
19
33
  cycleNodes: string[];
20
34
  nextIndex: number;
21
35
  total: number;
36
+ debug?: FormulaEvalDebug;
22
37
  };
23
38
  export declare function isFormulaEvalPending(ctx: {
24
39
  isFormulaCalculating?: boolean;
25
40
  formulaAsyncEval?: FormulaAsyncEvalJob | null;
26
41
  }): boolean;
42
+ /**
43
+ * The worker snapshot evaluator intentionally handles only scalar formulas that
44
+ * mirror the main engine well. Dynamic/spill/range-indirection formulas stay on
45
+ * the main thread so `spillSortResult` and special range logic remain authoritative.
46
+ */
47
+ export declare function isFormulaWorkerUnsafe(calcFuncStr: string): boolean;
@@ -1,13 +1,14 @@
1
1
  import { Context } from '../context';
2
- import { SnapshotEvalInput, SnapshotEvalOutput, SnapshotFormulaCell } from './formula-snapshot-eval';
2
+ import { SnapshotEvalInput, SnapshotEvalOutput, SnapshotFormulaCell, evalFormulasInSnapshot } from './formula-snapshot-eval';
3
3
  import { FORMULA_WORKER_CHUNK_SIZE } from './formula-async-eval';
4
4
 
5
5
  export declare function buildSnapshotEvalInput(ctx: Context, formulas: SnapshotFormulaCell[]): SnapshotEvalInput;
6
6
  /**
7
7
  * Evaluate a formula chunk off the critical UI path when possible.
8
- * Uses an inline Web Worker; falls back to main-thread snapshot eval.
8
+ * Uses an inline Web Worker. Callers should fall back to the real engine on
9
+ * rejection so the worker cannot silently leave a recalculation job hanging.
9
10
  */
10
11
  export declare function evalFormulasInBackground(input: SnapshotEvalInput): Promise<SnapshotEvalOutput>;
11
12
  /** @deprecated Use evalFormulasInBackground */
12
13
  export declare const evalFormulasInWorker: typeof evalFormulasInBackground;
13
- export { FORMULA_WORKER_CHUNK_SIZE };
14
+ export { FORMULA_WORKER_CHUNK_SIZE, evalFormulasInSnapshot };
@@ -40,6 +40,12 @@ export declare class FormulaCache {
40
40
  depsByCell: Map<string, Set<string>>;
41
41
  /** Reverse dependency graph: referenced cell -> dependent formula cells. */
42
42
  revDepsByCell: Map<string, Set<string>>;
43
+ /**
44
+ * Formulas that referenced a range too large to fully expand into `revDepsByCell`.
45
+ * These must be included on incremental recalcs because a single-cell edit may
46
+ * affect them even when no precise reverse edge exists.
47
+ */
48
+ formulasWithWideRangeDeps: Set<string>;
43
49
  /**
44
50
  * Dependency collection state for the currently-parsed formula, set by `execfunction`.
45
51
  * When null, dependency recording is disabled.
@@ -47,6 +53,7 @@ export declare class FormulaCache {
47
53
  activeDepCollection: null | {
48
54
  originKey: string;
49
55
  deps: Set<string>;
56
+ hasWideRangeDep: boolean;
50
57
  };
51
58
  /** Step 2: per execFunctionGroup pass cache for materialized range reads. */
52
59
  rangeValuePassCache?: Map<string, RangePassCacheEntry>;
@@ -70,7 +77,7 @@ export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: nu
70
77
  export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, calcChainSet?: Set<string>, isrefresh?: boolean, notInsertFunc?: boolean): any[];
71
78
  export declare function groupValuesRefresh(ctx: Context): void;
72
79
  /** Apply worker chunk output onto the live context (main thread only). */
73
- export declare function applyWorkerFormulaChunkResults(ctx: Context, output: SnapshotEvalOutput, impactedByCircular: Set<string>, cycleNodes: Set<string>): void;
80
+ export declare function applyWorkerFormulaChunkResults(ctx: Context, output: SnapshotEvalOutput, impactedByCircular: Set<string>, cycleNodes: Set<string>, calcChainKeys?: string[], data?: CellMatrix | null): void;
74
81
  /** Run up to `chunkSize` formulas from an async job. Returns true when job is complete. */
75
82
  export declare function runFormulaEvalChunk(ctx: Context, job: FormulaAsyncEvalJob, chunkSize?: number): boolean;
76
83
  export declare function execFunctionGroup(ctx: Context, origin_r: number, origin_c: number, value: any, id?: string, data?: any, isForce?: boolean): void;