@gridsheet/preact-core 2.2.0 → 3.0.0-rc.0
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/components/RowMenu.d.ts +3 -0
- package/dist/constants.d.ts +9 -0
- package/dist/formula/evaluator.d.ts +2 -0
- package/dist/formula/functions/__async.d.ts +59 -0
- package/dist/formula/functions/__base.d.ts +5 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1358 -570
- package/dist/index.js.map +1 -1
- package/dist/lib/cell.d.ts +3 -0
- package/dist/lib/{converters.d.ts → coords.d.ts} +1 -1
- package/dist/lib/hub.d.ts +4 -7
- package/dist/lib/operation.d.ts +1 -0
- package/dist/lib/{structs.d.ts → spatial.d.ts} +17 -1
- package/dist/lib/table.d.ts +112 -65
- package/dist/renderers/core.d.ts +1 -0
- package/dist/store/actions.d.ts +17 -37
- package/dist/styles/minified.d.ts +2 -2
- package/dist/types.d.ts +23 -12
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ export declare class Special {
|
|
|
15
15
|
name: string;
|
|
16
16
|
constructor(name: string);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Sentinel value representing an in-flight async formula computation.
|
|
20
|
+
* Cells whose solved cache contains a Pending will render a loading indicator.
|
|
21
|
+
* Dependent cells that encounter a Pending value also become pending.
|
|
22
|
+
*/
|
|
23
|
+
export declare class Pending {
|
|
24
|
+
promise: Promise<any>;
|
|
25
|
+
constructor(promise: Promise<any>);
|
|
26
|
+
}
|
|
18
27
|
export declare const SECONDS_IN_DAY = 86400;
|
|
19
28
|
export declare const FULLDATE_FORMAT_UTC = "YYYY-MM-DDTHH:mm:ss.SSSZ";
|
|
20
29
|
export declare const RESET_ZONE: ZoneType;
|
|
@@ -22,7 +22,9 @@ export declare class FormulaError {
|
|
|
22
22
|
code: string;
|
|
23
23
|
message: string;
|
|
24
24
|
error?: Error;
|
|
25
|
+
__isFormulaError: boolean;
|
|
25
26
|
constructor(code: string, message: string, error?: Error);
|
|
27
|
+
static is(obj: any): boolean;
|
|
26
28
|
}
|
|
27
29
|
declare class Entity<T = any> {
|
|
28
30
|
value: T;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Pending, Special } from '../../constants';
|
|
2
|
+
import { Wire } from '../../lib/hub';
|
|
3
|
+
import { PointType } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Sentinel value to distinguish cache miss from user-returned undefined/null.
|
|
6
|
+
* Since user functions can return undefined or null, we need a special marker
|
|
7
|
+
* to indicate "no cache entry found" vs "cache entry is undefined".
|
|
8
|
+
*/
|
|
9
|
+
export declare const asyncCacheMiss: Special;
|
|
10
|
+
/** Returns true if any element of `args` is a Pending sentinel. */
|
|
11
|
+
export declare const hasPendingArg: (args: any[]) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Build a cache key from function name + hashed serialised arguments.
|
|
14
|
+
*
|
|
15
|
+
* Format: `funcName:length:hash1-hash2-...`
|
|
16
|
+
* - length: byte length of the JSON-serialised args
|
|
17
|
+
* - hash: cyrb53 hash of the JSON string, repeated hashPrecision times with different seeds
|
|
18
|
+
*
|
|
19
|
+
* When a Table appears as an argument its trimmed area is converted to a
|
|
20
|
+
* value matrix (`any[][]`) via `getFieldMatrix()` so the key reflects the
|
|
21
|
+
* actual cell values the function will operate on.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildAsyncCacheKey: (funcName: string, bareArgs: any[], hashPrecision?: number) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Try to retrieve a cached or pending async result for the given cache key.
|
|
26
|
+
*
|
|
27
|
+
* Returns:
|
|
28
|
+
* - Cached value if present, valid, and not expired
|
|
29
|
+
* - Pending if there is an in-flight promise for this cell
|
|
30
|
+
* - asyncCacheMiss if no cache/pending exists (distinguishes from user-returned undefined/null)
|
|
31
|
+
*/
|
|
32
|
+
export declare const getAsyncCache: (table: {
|
|
33
|
+
wire: Wire;
|
|
34
|
+
getId: (p: PointType) => string;
|
|
35
|
+
}, origin: PointType, key: string) => any;
|
|
36
|
+
/**
|
|
37
|
+
* Handle an async (Promise) result returned by BaseFunction.main().
|
|
38
|
+
*
|
|
39
|
+
* Cache is stored per-cell in cell.asyncCache.
|
|
40
|
+
* In-flight tracking uses Wire.asyncPending (keyed by cell ID).
|
|
41
|
+
*
|
|
42
|
+
* Flow:
|
|
43
|
+
* 1. If cell has asyncCache and the key matches (inputs unchanged) and not expired → return cached value
|
|
44
|
+
* 2. If there is already an in-flight promise for this cell → return its Pending
|
|
45
|
+
* 3. Otherwise start the async work, return a new Pending, and on completion
|
|
46
|
+
* write the result into cell.asyncCache and trigger a re-render.
|
|
47
|
+
*
|
|
48
|
+
* @param ttlMilliseconds - Cache time-to-live in **milliseconds**. undefined = never expires.
|
|
49
|
+
*/
|
|
50
|
+
export declare const getOrSaveAsyncCache: (promise: Promise<any>, table: {
|
|
51
|
+
wire: Wire;
|
|
52
|
+
getId: (p: PointType) => string;
|
|
53
|
+
}, origin: PointType, key: string, ttlMilliseconds?: number) => any;
|
|
54
|
+
/**
|
|
55
|
+
* Create a Pending sentinel that resolves immediately.
|
|
56
|
+
* Used when an argument is already pending — the result is propagated.
|
|
57
|
+
*/
|
|
58
|
+
export declare const createPropagatedPending: () => Pending;
|
|
59
|
+
//# sourceMappingURL=__async.d.ts.map
|
|
@@ -13,11 +13,16 @@ export declare class BaseFunction {
|
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
15
15
|
}[];
|
|
16
|
+
/** Cache TTL in milliseconds. Override in subclass to set expiry. undefined = never expires. */
|
|
17
|
+
protected ttlMilliseconds?: number;
|
|
18
|
+
/** Hash precision for cache key generation. Higher values reduce collision risk. Default: 1 */
|
|
19
|
+
protected hashPrecision: number;
|
|
16
20
|
protected bareArgs: any[];
|
|
17
21
|
protected table: Table;
|
|
18
22
|
protected origin?: PointType;
|
|
19
23
|
constructor({ args, table, origin }: FunctionProps);
|
|
20
24
|
protected validate(): void;
|
|
25
|
+
private get isMainAsync();
|
|
21
26
|
call(): any;
|
|
22
27
|
}
|
|
23
28
|
export type FunctionMapping = {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ export { Renderer } from './renderers/core';
|
|
|
3
3
|
export type { RendererMixinType, RendererCallProps, RenderProps } from './renderers/core';
|
|
4
4
|
export { Parser } from './parsers/core';
|
|
5
5
|
export type { ParserMixinType } from './parsers/core';
|
|
6
|
-
export { oa2aa, aa2oa, buildInitialCells, buildInitialCellsFromOrigin, zoneToArea, areaToZone, areaToRange, } from './lib/
|
|
6
|
+
export { oa2aa, aa2oa, buildInitialCells, buildInitialCellsFromOrigin, zoneToArea, areaToZone, areaToRange, addressesToAreas, addressesToCols, addressesToRows, } from './lib/spatial';
|
|
7
7
|
export { TimeDelta } from './lib/time';
|
|
8
|
-
export { x2c, c2x, y2r, r2y, p2a, a2p } from './lib/
|
|
8
|
+
export { x2c, c2x, y2r, r2y, p2a, a2p } from './lib/coords';
|
|
9
9
|
export { updateTable } from './store/actions';
|
|
10
10
|
export { PluginBase, useInitialPluginContext, usePluginContext } from './components/PluginBase';
|
|
11
|
-
export type { MatrixType, CellType, FilterCondition, FilterConditionMethod, FilterConfig, FeedbackType, OptionsType, WriterType, CellsByAddressType, CellsByIdType, ModeType, HeadersType, HistoryType, HistorySortRowsType, StoreType, PointType, AreaType, ZoneType, Props, Connector, EditorEvent, CursorStateType, } from './types';
|
|
11
|
+
export type { MatrixType, CellType, Address, AsyncCache, FilterCondition, FilterConditionMethod, FilterConfig, FeedbackType, OptionsType, WriterType, CellsByAddressType, CellsByIdType, ModeType, HeadersType, HistoryType, HistorySortRowsType, StoreType, PointType, AreaType, ZoneType, Props, Connector, EditorEvent, CursorStateType, } from './types';
|
|
12
12
|
export type { HubType, HubProps, WireProps, TransmitProps } from './lib/hub';
|
|
13
13
|
export { Wire, useHub, createHub } from './lib/hub';
|
|
14
14
|
export type { Dispatcher } from './store';
|
|
@@ -20,13 +20,14 @@ export { Table, type UserTable } from './lib/table';
|
|
|
20
20
|
export { Policy } from './policy/core';
|
|
21
21
|
export type { PolicyType, PolicyOption, PolicyMixinType } from './policy/core';
|
|
22
22
|
export * as operations from './lib/operation';
|
|
23
|
-
export { DEFAULT_HISTORY_LIMIT } from './constants';
|
|
23
|
+
export { DEFAULT_HISTORY_LIMIT, Pending } from './constants';
|
|
24
24
|
export { userActions } from './store/actions';
|
|
25
25
|
export { clip } from './lib/clipboard';
|
|
26
26
|
export { makeBorder } from './styles/utils';
|
|
27
27
|
export { syncers } from './store/dispatchers';
|
|
28
28
|
export { ensureString, ensureNumber, ensureBoolean } from './formula/functions/__utils';
|
|
29
29
|
export type { EnsureNumberOptions, EnsureBooleanOptions } from './formula/functions/__utils';
|
|
30
|
+
export { solveTable } from './formula/solver';
|
|
30
31
|
//# sourceMappingURL=index.d.ts.map
|
|
31
32
|
export { h, render } from "preact";
|
|
32
33
|
export {
|