@zengrid/shared 1.0.2 → 1.0.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/package.json +1 -1
- package/dist/README.md +0 -44
- package/dist/index.cjs.default.js +0 -1
- package/dist/index.cjs.js +0 -6250
- package/dist/index.cjs.mjs +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +0 -6207
- package/dist/package.json +0 -54
- package/dist/src/algorithms/filter/bloom-filter.d.ts +0 -120
- package/dist/src/algorithms/filter/bloom-filter.d.ts.map +0 -1
- package/dist/src/algorithms/filter/index.d.ts +0 -7
- package/dist/src/algorithms/filter/index.d.ts.map +0 -1
- package/dist/src/algorithms/graph/bfs.d.ts +0 -71
- package/dist/src/algorithms/graph/bfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/dfs.d.ts +0 -62
- package/dist/src/algorithms/graph/dfs.d.ts.map +0 -1
- package/dist/src/algorithms/graph/graph.interface.d.ts +0 -63
- package/dist/src/algorithms/graph/graph.interface.d.ts.map +0 -1
- package/dist/src/algorithms/graph/index.d.ts +0 -9
- package/dist/src/algorithms/graph/index.d.ts.map +0 -1
- package/dist/src/algorithms/index.d.ts +0 -11
- package/dist/src/algorithms/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/index.d.ts +0 -8
- package/dist/src/algorithms/pattern/index.d.ts.map +0 -1
- package/dist/src/algorithms/pattern/sequence-detector.d.ts +0 -62
- package/dist/src/algorithms/pattern/sequence-detector.d.ts.map +0 -1
- package/dist/src/algorithms/search/binary-search.d.ts +0 -86
- package/dist/src/algorithms/search/binary-search.d.ts.map +0 -1
- package/dist/src/algorithms/search/index.d.ts +0 -6
- package/dist/src/algorithms/search/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/comparators.d.ts +0 -126
- package/dist/src/algorithms/sorting/comparators.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/index.d.ts +0 -9
- package/dist/src/algorithms/sorting/index.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/sorting.interface.d.ts +0 -38
- package/dist/src/algorithms/sorting/sorting.interface.d.ts.map +0 -1
- package/dist/src/algorithms/sorting/timsort.d.ts +0 -55
- package/dist/src/algorithms/sorting/timsort.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.d.ts +0 -52
- package/dist/src/data-structures/column-store/column-store.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/column-store.interface.d.ts +0 -155
- package/dist/src/data-structures/column-store/column-store.interface.d.ts.map +0 -1
- package/dist/src/data-structures/column-store/index.d.ts +0 -6
- package/dist/src/data-structures/column-store/index.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.d.ts +0 -61
- package/dist/src/data-structures/command-stack/command-stack.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts +0 -80
- package/dist/src/data-structures/command-stack/command-stack.interface.d.ts.map +0 -1
- package/dist/src/data-structures/command-stack/index.d.ts +0 -3
- package/dist/src/data-structures/command-stack/index.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts +0 -147
- package/dist/src/data-structures/dependency-graph/dependency-graph.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts +0 -161
- package/dist/src/data-structures/dependency-graph/dependency-graph.interface.d.ts.map +0 -1
- package/dist/src/data-structures/dependency-graph/index.d.ts +0 -8
- package/dist/src/data-structures/dependency-graph/index.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts +0 -84
- package/dist/src/data-structures/disjoint-set/disjoint-set.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts +0 -185
- package/dist/src/data-structures/disjoint-set/disjoint-set.interface.d.ts.map +0 -1
- package/dist/src/data-structures/disjoint-set/index.d.ts +0 -7
- package/dist/src/data-structures/disjoint-set/index.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.d.ts +0 -150
- package/dist/src/data-structures/index-map/index-map.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index-map.interface.d.ts +0 -186
- package/dist/src/data-structures/index-map/index-map.interface.d.ts.map +0 -1
- package/dist/src/data-structures/index-map/index.d.ts +0 -6
- package/dist/src/data-structures/index-map/index.d.ts.map +0 -1
- package/dist/src/data-structures/index.d.ts +0 -36
- package/dist/src/data-structures/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/index.d.ts +0 -7
- package/dist/src/data-structures/interval-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts +0 -141
- package/dist/src/data-structures/interval-tree/interval-tree.d.ts.map +0 -1
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts +0 -212
- package/dist/src/data-structures/interval-tree/interval-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/index.d.ts +0 -3
- package/dist/src/data-structures/lru-cache/index.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts +0 -134
- package/dist/src/data-structures/lru-cache/lru-cache.d.ts.map +0 -1
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts +0 -173
- package/dist/src/data-structures/lru-cache/lru-cache.interface.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/index.d.ts +0 -6
- package/dist/src/data-structures/prefix-sum-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts +0 -63
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.d.ts.map +0 -1
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts +0 -80
- package/dist/src/data-structures/prefix-sum-array/prefix-sum-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/index.d.ts +0 -8
- package/dist/src/data-structures/rtree/index.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.d.ts +0 -81
- package/dist/src/data-structures/rtree/rtree.d.ts.map +0 -1
- package/dist/src/data-structures/rtree/rtree.interface.d.ts +0 -143
- package/dist/src/data-structures/rtree/rtree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/index.d.ts +0 -4
- package/dist/src/data-structures/segment-tree/index.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts +0 -134
- package/dist/src/data-structures/segment-tree/segment-tree.d.ts.map +0 -1
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts +0 -202
- package/dist/src/data-structures/segment-tree/segment-tree.interface.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/index.d.ts +0 -4
- package/dist/src/data-structures/skip-list/index.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.d.ts +0 -137
- package/dist/src/data-structures/skip-list/skip-list.d.ts.map +0 -1
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts +0 -223
- package/dist/src/data-structures/skip-list/skip-list.interface.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/index.d.ts +0 -6
- package/dist/src/data-structures/sparse-matrix/index.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts +0 -44
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.d.ts.map +0 -1
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts +0 -105
- package/dist/src/data-structures/sparse-matrix/sparse-matrix.interface.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/index.d.ts +0 -3
- package/dist/src/data-structures/suffix-array/index.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts +0 -102
- package/dist/src/data-structures/suffix-array/suffix-array.d.ts.map +0 -1
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts +0 -117
- package/dist/src/data-structures/suffix-array/suffix-array.interface.d.ts.map +0 -1
- package/dist/src/data-structures/trie/index.d.ts +0 -8
- package/dist/src/data-structures/trie/index.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.d.ts +0 -205
- package/dist/src/data-structures/trie/trie.d.ts.map +0 -1
- package/dist/src/data-structures/trie/trie.interface.d.ts +0 -117
- package/dist/src/data-structures/trie/trie.interface.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -47
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/patterns/coordinator.d.ts +0 -90
- package/dist/src/patterns/coordinator.d.ts.map +0 -1
- package/dist/src/patterns/event-emitter.d.ts +0 -106
- package/dist/src/patterns/event-emitter.d.ts.map +0 -1
- package/dist/src/patterns/factory.d.ts +0 -120
- package/dist/src/patterns/factory.d.ts.map +0 -1
- package/dist/src/patterns/index.d.ts +0 -21
- package/dist/src/patterns/index.d.ts.map +0 -1
- package/dist/src/patterns/mediator.d.ts +0 -116
- package/dist/src/patterns/mediator.d.ts.map +0 -1
- package/dist/src/patterns/object-pool.d.ts +0 -178
- package/dist/src/patterns/object-pool.d.ts.map +0 -1
- package/dist/src/patterns/observer.d.ts +0 -89
- package/dist/src/patterns/observer.d.ts.map +0 -1
- package/dist/src/patterns/operation-mode.d.ts +0 -75
- package/dist/src/patterns/operation-mode.d.ts.map +0 -1
- package/dist/src/patterns/state-machine.d.ts +0 -122
- package/dist/src/patterns/state-machine.d.ts.map +0 -1
- package/dist/src/types/common.d.ts +0 -56
- package/dist/src/types/common.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -5
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -7
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/timing.d.ts +0 -104
- package/dist/src/utils/timing.d.ts.map +0 -1
- package/dist/src/utils/timing.interface.d.ts +0 -96
- package/dist/src/utils/timing.interface.d.ts.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Operation Mode Pattern
|
|
3
|
-
*
|
|
4
|
-
* Shared pattern for frontend/backend operation modes across grid features.
|
|
5
|
-
* Used for data loading, sorting, filtering, and other operations that can
|
|
6
|
-
* be executed either in-memory (frontend) or delegated to server (backend).
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Operation mode type
|
|
10
|
-
* - 'frontend': Execute operation in-memory (fast, suitable for loaded data)
|
|
11
|
-
* - 'backend': Delegate operation to server (ideal for large datasets, pagination)
|
|
12
|
-
* - 'auto': Automatically choose based on callback presence
|
|
13
|
-
*/
|
|
14
|
-
export type OperationMode = 'frontend' | 'backend' | 'auto';
|
|
15
|
-
/**
|
|
16
|
-
* Resolved operation mode (auto is resolved to frontend or backend)
|
|
17
|
-
*/
|
|
18
|
-
export type ResolvedOperationMode = 'frontend' | 'backend';
|
|
19
|
-
/**
|
|
20
|
-
* Operation mode configuration
|
|
21
|
-
*/
|
|
22
|
-
export interface OperationModeConfig<TCallback = any> {
|
|
23
|
-
/**
|
|
24
|
-
* Operation mode
|
|
25
|
-
* @default 'frontend'
|
|
26
|
-
*/
|
|
27
|
-
mode?: OperationMode;
|
|
28
|
-
/**
|
|
29
|
-
* Callback for backend operations
|
|
30
|
-
* If provided with mode='auto', backend mode is used
|
|
31
|
-
*/
|
|
32
|
-
callback?: TCallback;
|
|
33
|
-
/**
|
|
34
|
-
* Threshold for auto mode decision (optional)
|
|
35
|
-
* E.g., if rowCount > threshold, use backend mode
|
|
36
|
-
*/
|
|
37
|
-
autoThreshold?: number;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Resolve operation mode from configuration
|
|
41
|
-
*
|
|
42
|
-
* @param config - Operation mode configuration
|
|
43
|
-
* @param context - Optional context for auto mode decisions (e.g., rowCount)
|
|
44
|
-
* @returns Resolved mode ('frontend' or 'backend')
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveOperationMode<TCallback = any>(config: OperationModeConfig<TCallback>, context?: {
|
|
47
|
-
rowCount?: number;
|
|
48
|
-
}): ResolvedOperationMode;
|
|
49
|
-
/**
|
|
50
|
-
* Operation mode manager - Base class for feature-specific managers
|
|
51
|
-
*/
|
|
52
|
-
export declare abstract class OperationModeManager<TCallback = any> {
|
|
53
|
-
protected mode: ResolvedOperationMode;
|
|
54
|
-
protected callback?: TCallback;
|
|
55
|
-
constructor(config: OperationModeConfig<TCallback>, context?: {
|
|
56
|
-
rowCount?: number;
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* Get current operation mode
|
|
60
|
-
*/
|
|
61
|
-
getMode(): ResolvedOperationMode;
|
|
62
|
-
/**
|
|
63
|
-
* Check if in frontend mode
|
|
64
|
-
*/
|
|
65
|
-
isFrontendMode(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Check if in backend mode
|
|
68
|
-
*/
|
|
69
|
-
isBackendMode(): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Execute operation based on mode
|
|
72
|
-
*/
|
|
73
|
-
protected executeOperation<TResult>(frontendOperation: () => TResult | Promise<TResult>, backendOperation: () => TResult | Promise<TResult>): Promise<TResult>;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=operation-mode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-mode.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/patterns/operation-mode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,SAAS,GAAG,GAAG;IAClD;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,GAAG,GAAG,EAClD,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,EACtC,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,qBAAqB,CAmBvB;AAED;;GAEG;AACH,8BAAsB,oBAAoB,CAAC,SAAS,GAAG,GAAG;IACxD,SAAS,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;gBAEnB,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAKnF;;OAEG;IACH,OAAO,IAAI,qBAAqB;IAIhC;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;cACa,gBAAgB,CAAC,OAAO,EACtC,iBAAiB,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EACnD,gBAAgB,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GACjD,OAAO,CAAC,OAAO,CAAC;CAOpB"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State Machine Pattern
|
|
3
|
-
*
|
|
4
|
-
* Manages state transitions in a predictable way, ensuring
|
|
5
|
-
* only valid state transitions occur.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* type GridState = 'idle' | 'loading' | 'scrolling' | 'editing';
|
|
10
|
-
* type GridEvent = 'load' | 'scroll' | 'edit' | 'done';
|
|
11
|
-
*
|
|
12
|
-
* const machine = new StateMachine<GridState, GridEvent>('idle');
|
|
13
|
-
*
|
|
14
|
-
* // Define valid transitions
|
|
15
|
-
* machine.addTransition('idle', 'load', 'loading');
|
|
16
|
-
* machine.addTransition('loading', 'done', 'idle');
|
|
17
|
-
* machine.addTransition('idle', 'scroll', 'scrolling');
|
|
18
|
-
* machine.addTransition('scrolling', 'done', 'idle');
|
|
19
|
-
* machine.addTransition('idle', 'edit', 'editing');
|
|
20
|
-
* machine.addTransition('editing', 'done', 'idle');
|
|
21
|
-
*
|
|
22
|
-
* // Listen to state changes
|
|
23
|
-
* machine.onTransition((from, event, to) => {
|
|
24
|
-
* console.log(`${from} --[${event}]--> ${to}`);
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* // Trigger transitions
|
|
28
|
-
* machine.transition('load'); // idle -> loading
|
|
29
|
-
* machine.transition('done'); // loading -> idle
|
|
30
|
-
* machine.transition('invalid'); // Error: no valid transition
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export interface StateMachineOptions {
|
|
34
|
-
/** Enable strict mode (throw errors on invalid transitions) */
|
|
35
|
-
strict?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface TransitionHandler<S, E> {
|
|
38
|
-
(from: S, event: E, to: S): void;
|
|
39
|
-
}
|
|
40
|
-
export interface IStateMachine<S, E> {
|
|
41
|
-
/** Get the current state */
|
|
42
|
-
readonly state: S;
|
|
43
|
-
/** Attempt a state transition */
|
|
44
|
-
transition(event: E): boolean;
|
|
45
|
-
/** Check if a state is the current state */
|
|
46
|
-
is(state: S): boolean;
|
|
47
|
-
/** Check if a transition is valid from the current state */
|
|
48
|
-
can(event: E): boolean;
|
|
49
|
-
/** Add a valid transition */
|
|
50
|
-
addTransition(from: S, event: E, to: S): void;
|
|
51
|
-
/** Remove a transition */
|
|
52
|
-
removeTransition(from: S, event: E): void;
|
|
53
|
-
/** Register a transition handler */
|
|
54
|
-
onTransition(handler: TransitionHandler<S, E>): () => void;
|
|
55
|
-
/** Reset to initial state */
|
|
56
|
-
reset(): void;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* State machine implementation
|
|
60
|
-
*
|
|
61
|
-
* @typeParam S - State type (string literal union recommended)
|
|
62
|
-
* @typeParam E - Event type (string literal union recommended)
|
|
63
|
-
*/
|
|
64
|
-
export declare class StateMachine<S extends string = string, E extends string = string> implements IStateMachine<S, E> {
|
|
65
|
-
private currentState;
|
|
66
|
-
private readonly initialState;
|
|
67
|
-
private transitions;
|
|
68
|
-
private handlers;
|
|
69
|
-
private readonly strict;
|
|
70
|
-
constructor(initialState: S, options?: StateMachineOptions);
|
|
71
|
-
/**
|
|
72
|
-
* Get the current state
|
|
73
|
-
*/
|
|
74
|
-
get state(): S;
|
|
75
|
-
/**
|
|
76
|
-
* Add a valid transition
|
|
77
|
-
*
|
|
78
|
-
* @param from - The state to transition from
|
|
79
|
-
* @param event - The event that triggers the transition
|
|
80
|
-
* @param to - The state to transition to
|
|
81
|
-
*/
|
|
82
|
-
addTransition(from: S, event: E, to: S): void;
|
|
83
|
-
/**
|
|
84
|
-
* Remove a transition
|
|
85
|
-
*/
|
|
86
|
-
removeTransition(from: S, event: E): void;
|
|
87
|
-
/**
|
|
88
|
-
* Attempt a state transition
|
|
89
|
-
*
|
|
90
|
-
* @param event - The event to trigger
|
|
91
|
-
* @returns true if the transition was successful, false otherwise
|
|
92
|
-
*/
|
|
93
|
-
transition(event: E): boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Check if the current state matches
|
|
96
|
-
*/
|
|
97
|
-
is(state: S): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Check if a transition is valid from the current state
|
|
100
|
-
*/
|
|
101
|
-
can(event: E): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Register a transition handler
|
|
104
|
-
*
|
|
105
|
-
* @param handler - Function called on each transition
|
|
106
|
-
* @returns Unsubscribe function
|
|
107
|
-
*/
|
|
108
|
-
onTransition(handler: TransitionHandler<S, E>): () => void;
|
|
109
|
-
/**
|
|
110
|
-
* Reset to initial state
|
|
111
|
-
*/
|
|
112
|
-
reset(): void;
|
|
113
|
-
/**
|
|
114
|
-
* Get all possible transitions from the current state
|
|
115
|
-
*/
|
|
116
|
-
getAvailableTransitions(): E[];
|
|
117
|
-
/**
|
|
118
|
-
* Get a visual representation of the state machine
|
|
119
|
-
*/
|
|
120
|
-
toGraphviz(): string;
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=state-machine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/patterns/state-machine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC;IACrC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB,iCAAiC;IACjC,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAE9B,4CAA4C;IAC5C,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAEtB,4DAA4D;IAC5D,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IAEvB,6BAA6B;IAC7B,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC;IAE9C,0BAA0B;IAC1B,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAE1C,oCAAoC;IACpC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAE3D,6BAA6B;IAC7B,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;GAKG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,CAC5E,YAAW,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B,OAAO,CAAC,YAAY,CAAI;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAI;IACjC,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;gBAErB,YAAY,EAAE,CAAC,EAAE,OAAO,GAAE,mBAAwB;IAM9D;;OAEG;IACH,IAAI,KAAK,IAAI,CAAC,CAEb;IAED;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI;IAO7C;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAIzC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IA2B7B;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAIrB;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO;IAItB;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI;IAK1D;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,uBAAuB,IAAI,CAAC,EAAE;IAK9B;;OAEG;IACH,UAAU,IAAI,MAAM;CAYrB"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common types used across ZenGrid algorithms and data structures
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Comparator function for sorting and ordering
|
|
6
|
-
* @returns Negative if a < b, zero if a === b, positive if a > b
|
|
7
|
-
*/
|
|
8
|
-
export type Comparator<T> = (a: T, b: T) => number;
|
|
9
|
-
/**
|
|
10
|
-
* Predicate function for filtering
|
|
11
|
-
* @returns true if the value matches the condition
|
|
12
|
-
*/
|
|
13
|
-
export type Predicate<T> = (value: T) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Equality function for comparing values
|
|
16
|
-
* @returns true if values are equal
|
|
17
|
-
*/
|
|
18
|
-
export type EqualityFn<T> = (a: T, b: T) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Hash function for creating keys from values
|
|
21
|
-
* @returns string representation of the value
|
|
22
|
-
*/
|
|
23
|
-
export type HashFn<T> = (value: T) => string;
|
|
24
|
-
/**
|
|
25
|
-
* Generic range interface
|
|
26
|
-
*/
|
|
27
|
-
export interface Range {
|
|
28
|
-
start: number;
|
|
29
|
-
end: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 2D rectangle interface
|
|
33
|
-
*/
|
|
34
|
-
export interface Rectangle {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
width: number;
|
|
38
|
-
height: number;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 2D point interface
|
|
42
|
-
*/
|
|
43
|
-
export interface Point {
|
|
44
|
-
x: number;
|
|
45
|
-
y: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Bounding box interface
|
|
49
|
-
*/
|
|
50
|
-
export interface BoundingBox {
|
|
51
|
-
minX: number;
|
|
52
|
-
minY: number;
|
|
53
|
-
maxX: number;
|
|
54
|
-
maxY: number;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,MAAM,EACN,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,GACZ,MAAM,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Timing utilities for performance optimization
|
|
3
|
-
* @module @zengrid/shared/utils/timing
|
|
4
|
-
*/
|
|
5
|
-
import type { DebounceOptions, DebouncedFunction, ThrottleOptions, ThrottledFunction, RAFBatchScheduler } from './timing.interface';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a debounced function that delays invoking func until after wait milliseconds
|
|
8
|
-
* have elapsed since the last time the debounced function was invoked.
|
|
9
|
-
*
|
|
10
|
-
* @param func - The function to debounce
|
|
11
|
-
* @param wait - The number of milliseconds to delay
|
|
12
|
-
* @param options - Options object
|
|
13
|
-
* @returns Debounced function with cancel and flush methods
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const handleResize = debounce(() => {
|
|
18
|
-
* console.log('Window resized');
|
|
19
|
-
* }, 250);
|
|
20
|
-
*
|
|
21
|
-
* window.addEventListener('resize', handleResize);
|
|
22
|
-
*
|
|
23
|
-
* // Cancel pending invocations
|
|
24
|
-
* handleResize.cancel();
|
|
25
|
-
*
|
|
26
|
-
* // Immediately invoke
|
|
27
|
-
* handleResize.flush();
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options?: DebounceOptions): DebouncedFunction<T>;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a throttled function that only invokes func at most once per every wait milliseconds.
|
|
33
|
-
*
|
|
34
|
-
* @param func - The function to throttle
|
|
35
|
-
* @param wait - The number of milliseconds to throttle invocations to
|
|
36
|
-
* @param options - Options object
|
|
37
|
-
* @returns Throttled function with cancel method
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* const handleScroll = throttle(() => {
|
|
42
|
-
* console.log('Scrolling');
|
|
43
|
-
* }, 100);
|
|
44
|
-
*
|
|
45
|
-
* window.addEventListener('scroll', handleScroll);
|
|
46
|
-
*
|
|
47
|
-
* // Cancel pending invocation
|
|
48
|
-
* handleScroll.cancel();
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare function throttle<T extends (...args: any[]) => any>(func: T, wait: number, options?: ThrottleOptions): ThrottledFunction<T>;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a RAF (RequestAnimationFrame) batch scheduler that coalesces multiple
|
|
54
|
-
* updates into a single animation frame.
|
|
55
|
-
*
|
|
56
|
-
* Useful for optimizing frequent DOM updates by batching them together.
|
|
57
|
-
*
|
|
58
|
-
* @returns RAF batch scheduler
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const scheduler = createRAFBatchScheduler();
|
|
63
|
-
*
|
|
64
|
-
* // Multiple calls in same frame will be batched
|
|
65
|
-
* scheduler.schedule(() => console.log('Update 1'));
|
|
66
|
-
* scheduler.schedule(() => console.log('Update 2'));
|
|
67
|
-
* scheduler.schedule(() => console.log('Update 3'));
|
|
68
|
-
* // All three will run in the same animation frame
|
|
69
|
-
*
|
|
70
|
-
* // Cancel all pending
|
|
71
|
-
* scheduler.cancelAll();
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare function createRAFBatchScheduler(): RAFBatchScheduler;
|
|
75
|
-
/**
|
|
76
|
-
* Delays execution for specified milliseconds. Returns a promise.
|
|
77
|
-
*
|
|
78
|
-
* @param ms - Milliseconds to delay
|
|
79
|
-
* @returns Promise that resolves after delay
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* await delay(1000); // Wait 1 second
|
|
84
|
-
* console.log('1 second later');
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export declare function delay(ms: number): Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Creates a timeout promise that rejects after specified milliseconds
|
|
90
|
-
*
|
|
91
|
-
* @param ms - Milliseconds before timeout
|
|
92
|
-
* @param message - Error message
|
|
93
|
-
* @returns Promise that rejects after timeout
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const result = await Promise.race([
|
|
98
|
-
* fetchData(),
|
|
99
|
-
* timeout(5000, 'Request timeout')
|
|
100
|
-
* ]);
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare function timeout(ms: number, message?: string): Promise<never>;
|
|
104
|
-
//# sourceMappingURL=timing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/utils/timing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,iBAAiB,CAAC,CAAC,CAAC,CA0HtB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,iBAAiB,CAAC,CAAC,CAAC,CAQtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,IAAI,iBAAiB,CAoD3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,SAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAIvE"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Timing utilities interfaces for performance optimization
|
|
3
|
-
* @module @zengrid/shared/utils/timing
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Options for debounce function
|
|
7
|
-
*/
|
|
8
|
-
export interface DebounceOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Call function on leading edge instead of trailing edge
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
leading?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Maximum time function is allowed to be delayed before it's invoked
|
|
16
|
-
*/
|
|
17
|
-
maxWait?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Call function on trailing edge
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
trailing?: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Options for throttle function
|
|
26
|
-
*/
|
|
27
|
-
export interface ThrottleOptions {
|
|
28
|
-
/**
|
|
29
|
-
* Call function on leading edge
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
leading?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Call function on trailing edge
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
trailing?: boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A debounced function with cancel and flush methods
|
|
41
|
-
*/
|
|
42
|
-
export interface DebouncedFunction<T extends (...args: any[]) => any> {
|
|
43
|
-
/**
|
|
44
|
-
* Call the debounced function
|
|
45
|
-
*/
|
|
46
|
-
(...args: Parameters<T>): void;
|
|
47
|
-
/**
|
|
48
|
-
* Cancel pending function invocations
|
|
49
|
-
*/
|
|
50
|
-
cancel(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Immediately invoke pending function calls
|
|
53
|
-
*/
|
|
54
|
-
flush(): ReturnType<T> | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Check if there are pending invocations
|
|
57
|
-
*/
|
|
58
|
-
pending(): boolean;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* A throttled function with cancel method
|
|
62
|
-
*/
|
|
63
|
-
export interface ThrottledFunction<T extends (...args: any[]) => any> {
|
|
64
|
-
/**
|
|
65
|
-
* Call the throttled function
|
|
66
|
-
*/
|
|
67
|
-
(...args: Parameters<T>): void;
|
|
68
|
-
/**
|
|
69
|
-
* Cancel pending function invocations
|
|
70
|
-
*/
|
|
71
|
-
cancel(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Check if there are pending invocations
|
|
74
|
-
*/
|
|
75
|
-
pending(): boolean;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* RAF batch scheduler for coalescing multiple updates
|
|
79
|
-
*/
|
|
80
|
-
export interface RAFBatchScheduler {
|
|
81
|
-
/**
|
|
82
|
-
* Schedule a callback to run in the next animation frame
|
|
83
|
-
* @param callback - Function to execute
|
|
84
|
-
* @returns Cancel function
|
|
85
|
-
*/
|
|
86
|
-
schedule(callback: () => void): () => void;
|
|
87
|
-
/**
|
|
88
|
-
* Cancel all pending callbacks
|
|
89
|
-
*/
|
|
90
|
-
cancelAll(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Get number of pending callbacks
|
|
93
|
-
*/
|
|
94
|
-
getPendingCount(): number;
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=timing.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timing.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/shared/src/utils/timing.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAClE;;OAEG;IACH,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;OAEG;IACH,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG;IAClE;;OAEG;IACH,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAE3C;;OAEG;IACH,SAAS,IAAI,IAAI,CAAC;IAElB;;OAEG;IACH,eAAe,IAAI,MAAM,CAAC;CAC3B"}
|